blob: 189a8ac643bd542db1e7dc5a82999624de65f62e [file] [log] [blame]
kprice159fa582006-05-08 21:30:45 +00001<?xml version="1.0" encoding="utf-8"?>
2<!--Arbortext, Inc., 1988-2005, 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>
8<titlealts>
9<searchtitle>Adding simple types</searchtitle>
10</titlealts>
kprice9623e9d2007-05-03 03:43:05 +000011<shortdesc>Simple types are used to create derived datatypes.
kprice647b7352006-05-17 21:27:16 +000012They provide a set of constraints on the value space (a set of values) and
13the lexical space (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>
18</metadata></prolog>
19<taskbody>
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
24other perspectives.</p><p>To add a simple type:</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>
31</step>
32<step><cmd>Type a new name for the simple type in the <uicontrol>Name</uicontrol> field.</cmd>
33</step>
kprice159fa582006-05-08 21:30:45 +000034<step><cmd>You can select the following options from the <uicontrol>Variety</uicontrol> list:</cmd>
35<choices>
36<choice><uicontrol>atomic</uicontrol>. Atomic types are all the simple types
37built into the XML schema language.</choice>
38<choice><uicontrol>list</uicontrol>. List types are comprised of sequences
39of atomic types. They have values that are comprised of finite-length sequences
40of atomic values. </choice>
41<choice><uicontrol>union</uicontrol>. A union type enables an element or attribute
42value to be one or more instances of one type drawn from the union of multiple
43atomic and list types.</choice>
44</choices>
45</step>
kprice647b7352006-05-17 21:27:16 +000046<step><cmd>If you selected <uicontrol>atomic</uicontrol> from the <uicontrol>Variety</uicontrol> list,
47click <uicontrol>Browse</uicontrol> <image href="../images/Browse.gif"><alt>This
48graphic is the Browse button</alt></image> next to the <uicontrol>Base type</uicontrol> field
49to specify a base type for the simple type.</cmd><info>The Set Type dialog
50box lists all built-in and user-defined types currently available. You can
51change the <uicontrol>Scope</uicontrol> of the list by selecting one of the
52following options:<ul>
kprice159fa582006-05-08 21:30:45 +000053<li><uicontrol>Workspace</uicontrol>. Lists all of the types available in
54your workspace. </li>
55<li><uicontrol>Enclosing Project</uicontrol>. Lists all of the types available
56in the project that contains your file. </li>
57<li>(Default) <uicontrol>Current Resource</uicontrol>. List all of the types
58available in your current file.</li>
59<li><uicontrol>Working Sets</uicontrol>. List all the types available within
60the selected working set.</li>
61</ul></info></step>
kprice647b7352006-05-17 21:27:16 +000062<step><cmd>If you selected <uicontrol>list</uicontrol> from the <uicontrol>Variety</uicontrol> list,
63click <uicontrol>Browse</uicontrol> <image href="../images/Browse.gif"><alt>This
64graphic is the Browse button</alt></image> next to the <uicontrol>Item type</uicontrol> field
65to specify a item type for the simple type.</cmd><info>The Set Type dialog
66box lists all built-in and user-defined types currently available. You can
67change the <uicontrol>Scope</uicontrol> of the list by selecting one of the
68following options:<ul>
kprice159fa582006-05-08 21:30:45 +000069<li><uicontrol>Workspace</uicontrol>. Lists all of the types available in
70your workspace. </li>
71<li><uicontrol>Enclosing Project</uicontrol>. Lists all of the types available
72in the project that contains your file. </li>
73<li>(Default) <uicontrol>Current Resource</uicontrol>. List all of the types
74available in your current file.</li>
75<li><uicontrol>Working Sets</uicontrol>. List all the types available within
76the selected working set.</li>
77</ul></info></step>
kprice647b7352006-05-17 21:27:16 +000078<step><cmd>If you selected <uicontrol>union</uicontrol> from the <uicontrol>Variety</uicontrol> list,
79click <uicontrol>Browse</uicontrol> <image href="../images/Browse.gif"><alt>This
80graphic is the Browse button</alt></image> next to the <uicontrol>Member types</uicontrol> field
81to specify the member types for the simple type.</cmd><info>You can select
82to add both <uicontrol>Built-in simple types</uicontrol> and <uicontrol>User-defined
kprice159fa582006-05-08 21:30:45 +000083simple types</uicontrol> to the member types value list. </info></step>
84<step><cmd>Click the <uicontrol>Constraints</uicontrol> tab.</cmd><info>From
85here you will be able to set specific constraint values including length constraints,
86enumerations, and patterns. </info>
87<substeps>
88<substep><cmd>Enumerations help you to define a set of valid values for simple
89types. They are the actual values the simple type can take as valid values
90in the instance document. You can either add one enumeration or several enumerations
91at a time:</cmd><info><ul>
92<li>To add one enumeration at a time, under <uicontrol>Specific constraint
kprice647b7352006-05-17 21:27:16 +000093values</uicontrol>, select <uicontrol>Enumerations</uicontrol> and click <uicontrol>Add</uicontrol> and
94specify a value for the enumeration.</li>
kprice159fa582006-05-08 21:30:45 +000095<li>To add several enumerations at one time, follow these steps:<ol>
kprice647b7352006-05-17 21:27:16 +000096<li>Select <uicontrol>Enumerations</uicontrol>.</li>
97<li>Click <uicontrol>Add</uicontrol>.</li>
kprice159fa582006-05-08 21:30:45 +000098<li>Enter the value of each enumeration. Each value must be separated by the <uicontrol>Delimiter
99character</uicontrol>. For example: <codeph>First, Second</codeph> will create
100two enumerations, one with the value "First" and one with the value "Second".</li>
101<li>Select the <uicontrol>Preserve leading and trailing whitespace</uicontrol> check
102box if you want any white space around your enumeration values to be preserved.
kprice647b7352006-05-17 21:27:16 +0000103If you select this check box, the values of <codeph>First, Second</codeph> will
kprice159fa582006-05-08 21:30:45 +0000104show up as "First" and " Second" (there is a space before Second) because
kprice647b7352006-05-17 21:27:16 +0000105you put a space before "Second" when entering the value.</li>
kprice159fa582006-05-08 21:30:45 +0000106<li>Click <uicontrol>OK</uicontrol>. Your enumerations will be created and
107appear in the Properties view.</li>
108</ol></li>
109</ul></info></substep>
110<substep><cmd>Patterns help you to place certain constraints regarding allowable
111values.</cmd><info>For example, you could restrict the field to only accept
112input which follows the pattern "five digits followed by two upper-case ASCII
113letters". To set a pattern constraint:<ol>
kprice647b7352006-05-17 21:27:16 +0000114<li>Select <uicontrol>Patterns</uicontrol>.</li>
115<li>Click <uicontrol>Add</uicontrol>.</li>
kprice159fa582006-05-08 21:30:45 +0000116<li>Create the regular expression pattern you wish to use as your constraint
117using the <uicontrol>Regular Expression</uicontrol> wizard.</li>
118<li>Click <uicontrol>Finish</uicontrol>.</li>
119</ol></info></substep>
120</substeps>
121</step>
122<step><cmd>Click the <uicontrol>Documentation</uicontrol> tab if you want
123to provide any information about this simple type.</cmd><info>The <uicontrol>Documentation</uicontrol> page
kprice647b7352006-05-17 21:27:16 +0000124is used for human readable material, such as a description.</info></step>
125<step><cmd>Click the <uicontrol>Extensions</uicontrol> tab if you want to
126add application information elements to your annotations of schema components.</cmd>
127<info>The <uicontrol>Extensions</uicontrol> page allows you to specify the
128schema and add XML content to your annotations.</info></step>
kprice159fa582006-05-08 21:30:45 +0000129</steps>
130</taskbody>
131</task>
kprice647b7352006-05-17 21:27:16 +0000132<?Pub *0000007829?>