blob: 437c1b9b11609ba52cfb4a4e0c376dd687c5799f [file] [log] [blame]
kprice159fa582006-05-08 21:30:45 +00001<?xml version="1.0" encoding="utf-8"?>
kpricede20a692008-04-24 00:27:47 +00002<!--Arbortext, Inc., 1988-2006, v.4002-->
kprice647b7352006-05-17 21:27:16 +00003<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN"
4 "task.dtd">
5<?Pub Inc?>
kprice159fa582006-05-08 21:30:45 +00006<task id="taddsmpt" xml:lang="en-us">
7<title>Adding simple types</title>
9<searchtitle>Adding simple types</searchtitle>
kpricede20a692008-04-24 00:27:47 +000011<shortdesc>Simple types are used to create derived datatypes. They provide
12a set of constraints on the value space (a set of values) and the lexical
13space (a set of valid literals) of a datatype.</shortdesc>
kprice159fa582006-05-08 21:30:45 +000014<prolog><metadata>
kprice9623e9d2007-05-03 03:43:05 +000015<keywords><indexterm>XML schema editor<indexterm>simple types</indexterm></indexterm>
16<indexterm>XML schema files<indexterm>simple types</indexterm></indexterm>
kprice159fa582006-05-08 21:30:45 +000017</keywords>
20<context><p>A simple type cannot have element content and cannot carry attributes.
21Elements that contain numbers (and strings, and dates, and so on) but do not
kprice647b7352006-05-17 21:27:16 +000022contain any sub-elements have a simple type.</p><p>The following instructions
23were written for the Resource perspective, but they will also work in many
kpricede20a692008-04-24 00:27:47 +000024other perspectives.</p><p>To add a simple type, complete the following steps:</p></context>
kprice159fa582006-05-08 21:30:45 +000025<steps>
26<step><cmd>Open your XML schema in the XML schema editor.</cmd></step>
27<step><cmd>In the Outline view, right-click <b>Types</b>, and click <uicontrol>Add
28Simple Type</uicontrol>.</cmd></step>
kprice647b7352006-05-17 21:27:16 +000029<step><cmd>In the Outline view, select the new simple type.</cmd></step>
30<step><cmd>In the Properties view, click the <uicontrol>General</uicontrol> tab.</cmd>
32<step><cmd>Type a new name for the simple type in the <uicontrol>Name</uicontrol> field.</cmd>
kprice159fa582006-05-08 21:30:45 +000034<step><cmd>You can select the following options from the <uicontrol>Variety</uicontrol> list:</cmd>
kpricede20a692008-04-24 00:27:47 +000036<choice><uicontrol>atomic</uicontrol>: atomic types are<?Pub Caret?> all the
37simple types built into the XML schema language.</choice>
38<choice><uicontrol>list</uicontrol>: list types are comprised of sequences
kprice159fa582006-05-08 21:30:45 +000039of atomic types. They have values that are comprised of finite-length sequences
40of atomic values. </choice>
kpricede20a692008-04-24 00:27:47 +000041<choice><uicontrol>union</uicontrol>: union types enable an element or attribute
kprice159fa582006-05-08 21:30:45 +000042value to be one or more instances of one type drawn from the union of multiple
43atomic and list types.</choice>
kpricede20a692008-04-24 00:27:47 +000046<step><cmd>If you selected <uicontrol>atomic</uicontrol> or <uicontrol>list</uicontrol> from
47the <uicontrol>Variety</uicontrol> drop-down, click <uicontrol>Browse</uicontrol> <image
48href="../images/Browse.gif"><alt>This graphic is the Browse button</alt></image> next
49to the <uicontrol>Base type</uicontrol> or <uicontrol>Item type</uicontrol> field
kprice647b7352006-05-17 21:27:16 +000050to specify a base type for the simple type.</cmd><info>The Set Type dialog
51box lists all built-in and user-defined types currently available. You can
52change the <uicontrol>Scope</uicontrol> of the list by selecting one of the
53following options:<ul>
kpricede20a692008-04-24 00:27:47 +000054<li><uicontrol>Workspace</uicontrol>: lists all of the types available in
kprice159fa582006-05-08 21:30:45 +000055your workspace. </li>
kpricede20a692008-04-24 00:27:47 +000056<li><uicontrol>Enclosing Project</uicontrol>: lists all of the types available
kprice159fa582006-05-08 21:30:45 +000057in the project that contains your file. </li>
kpricede20a692008-04-24 00:27:47 +000058<li>(Default) <uicontrol>Current Resource</uicontrol>: lists all of the types
kprice159fa582006-05-08 21:30:45 +000059available in your current file.</li>
kpricede20a692008-04-24 00:27:47 +000060<li><uicontrol>Working Sets</uicontrol>: lists all the types available within
kprice159fa582006-05-08 21:30:45 +000061the selected working set.</li>
kpricede20a692008-04-24 00:27:47 +000063<step><cmd>If you selected <uicontrol>union</uicontrol> from the <uicontrol>Variety</uicontrol> drop-down,
kprice647b7352006-05-17 21:27:16 +000064click <uicontrol>Browse</uicontrol> <image href="../images/Browse.gif"><alt>This
65graphic is the Browse button</alt></image> next to the <uicontrol>Member types</uicontrol> field
66to specify the member types for the simple type.</cmd><info>You can select
67to add both <uicontrol>Built-in simple types</uicontrol> and <uicontrol>User-defined
kprice159fa582006-05-08 21:30:45 +000068simple types</uicontrol> to the member types value list. </info></step>
69<step><cmd>Click the <uicontrol>Constraints</uicontrol> tab.</cmd><info>From
70here you will be able to set specific constraint values including length constraints,
71enumerations, and patterns. </info>
73<substep><cmd>Enumerations help you to define a set of valid values for simple
74types. They are the actual values the simple type can take as valid values
75in the instance document. You can either add one enumeration or several enumerations
76at a time:</cmd><info><ul>
77<li>To add one enumeration at a time, under <uicontrol>Specific constraint
kprice647b7352006-05-17 21:27:16 +000078values</uicontrol>, select <uicontrol>Enumerations</uicontrol> and click <uicontrol>Add</uicontrol> and
79specify a value for the enumeration.</li>
kpricede20a692008-04-24 00:27:47 +000080<li>To add several enumerations at one time:<ol>
81<li>Select <uicontrol>Enumerations</uicontrol> and click <uicontrol>Add</uicontrol>.</li>
kprice159fa582006-05-08 21:30:45 +000082<li>Enter the value of each enumeration. Each value must be separated by the <uicontrol>Delimiter
83character</uicontrol>. For example: <codeph>First, Second</codeph> will create
84two enumerations, one with the value "First" and one with the value "Second".</li>
85<li>Select the <uicontrol>Preserve leading and trailing whitespace</uicontrol> check
86box if you want any white space around your enumeration values to be preserved.
kprice647b7352006-05-17 21:27:16 +000087If you select this check box, the values of <codeph>First, Second</codeph> will
kprice159fa582006-05-08 21:30:45 +000088show up as "First" and " Second" (there is a space before Second) because
kprice647b7352006-05-17 21:27:16 +000089you put a space before "Second" when entering the value.</li>
kprice159fa582006-05-08 21:30:45 +000090<li>Click <uicontrol>OK</uicontrol>. Your enumerations will be created and
91appear in the Properties view.</li>
94<substep><cmd>Patterns help you to place certain constraints regarding allowable
95values.</cmd><info>For example, you could restrict the field to only accept
96input which follows the pattern "five digits followed by two upper-case ASCII
97letters". To set a pattern constraint:<ol>
kpricede20a692008-04-24 00:27:47 +000098<li>Select <uicontrol>Patterns</uicontrol> and click <uicontrol>Add</uicontrol>.</li>
kprice159fa582006-05-08 21:30:45 +000099<li>Create the regular expression pattern you wish to use as your constraint
100using the <uicontrol>Regular Expression</uicontrol> wizard.</li>
101<li>Click <uicontrol>Finish</uicontrol>.</li>
105<step><cmd>Click the <uicontrol>Documentation</uicontrol> tab if you want
106to provide any information about this simple type.</cmd><info>The <uicontrol>Documentation</uicontrol> page
kprice647b7352006-05-17 21:27:16 +0000107is used for human readable material, such as a description.</info></step>
108<step><cmd>Click the <uicontrol>Extensions</uicontrol> tab if you want to
109add application information elements to your annotations of schema components.</cmd>
110<info>The <uicontrol>Extensions</uicontrol> page allows you to specify the
111schema and add XML content to your annotations.</info></step>
kprice159fa582006-05-08 21:30:45 +0000112</steps>
kpricede20a692008-04-24 00:27:47 +0000115<?Pub *0000006649?>