kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
| 2 | <!--Arbortext, Inc., 1988-2005, v.4002-->
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 3 | <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN"
|
| 4 | "task.dtd">
|
| 5 | <?Pub Inc?>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 6 | <task id="taddsmpt" xml:lang="en-us">
|
| 7 | <title>Adding simple types</title>
|
| 8 | <titlealts>
|
| 9 | <searchtitle>Adding simple types</searchtitle>
|
| 10 | </titlealts>
|
kprice | 9623e9d | 2007-05-03 03:43:05 +0000 | [diff] [blame] | 11 | <shortdesc>Simple types are used to create derived datatypes.
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 12 | They provide a set of constraints on the value space (a set of values) and
|
| 13 | the lexical space (a set of valid literals) of a datatype.</shortdesc>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 14 | <prolog><metadata>
|
kprice | 9623e9d | 2007-05-03 03:43:05 +0000 | [diff] [blame] | 15 | <keywords><indexterm>XML schema editor<indexterm>simple types</indexterm></indexterm>
|
| 16 | <indexterm>XML schema files<indexterm>simple types</indexterm></indexterm>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 17 | </keywords>
|
| 18 | </metadata></prolog>
|
| 19 | <taskbody>
|
| 20 | <context><p>A simple type cannot have element content and cannot carry attributes.
|
| 21 | Elements that contain numbers (and strings, and dates, and so on) but do not
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 22 | contain any sub-elements have a simple type.</p><p>The following instructions
|
| 23 | were written for the Resource perspective, but they will also work in many
|
| 24 | other perspectives.</p><p>To add a simple type:</p></context>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 25 | <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
|
| 28 | Simple Type</uicontrol>.</cmd></step>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 29 | <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>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 34 | <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
|
| 37 | built into the XML schema language.</choice>
|
| 38 | <choice><uicontrol>list</uicontrol>. List types are comprised of sequences
|
| 39 | of atomic types. They have values that are comprised of finite-length sequences
|
| 40 | of atomic values. </choice>
|
| 41 | <choice><uicontrol>union</uicontrol>. A union type enables an element or attribute
|
| 42 | value to be one or more instances of one type drawn from the union of multiple
|
| 43 | atomic and list types.</choice>
|
| 44 | </choices>
|
| 45 | </step>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 46 | <step><cmd>If you selected <uicontrol>atomic</uicontrol> from the <uicontrol>Variety</uicontrol> list,
|
| 47 | click <uicontrol>Browse</uicontrol> <image href="../images/Browse.gif"><alt>This
|
| 48 | graphic is the Browse button</alt></image> next to the <uicontrol>Base type</uicontrol> field
|
| 49 | to specify a base type for the simple type.</cmd><info>The Set Type dialog
|
| 50 | box lists all built-in and user-defined types currently available. You can
|
| 51 | change the <uicontrol>Scope</uicontrol> of the list by selecting one of the
|
| 52 | following options:<ul>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 53 | <li><uicontrol>Workspace</uicontrol>. Lists all of the types available in
|
| 54 | your workspace. </li>
|
| 55 | <li><uicontrol>Enclosing Project</uicontrol>. Lists all of the types available
|
| 56 | in the project that contains your file. </li>
|
| 57 | <li>(Default) <uicontrol>Current Resource</uicontrol>. List all of the types
|
| 58 | available in your current file.</li>
|
| 59 | <li><uicontrol>Working Sets</uicontrol>. List all the types available within
|
| 60 | the selected working set.</li>
|
| 61 | </ul></info></step>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 62 | <step><cmd>If you selected <uicontrol>list</uicontrol> from the <uicontrol>Variety</uicontrol> list,
|
| 63 | click <uicontrol>Browse</uicontrol> <image href="../images/Browse.gif"><alt>This
|
| 64 | graphic is the Browse button</alt></image> next to the <uicontrol>Item type</uicontrol> field
|
| 65 | to specify a item type for the simple type.</cmd><info>The Set Type dialog
|
| 66 | box lists all built-in and user-defined types currently available. You can
|
| 67 | change the <uicontrol>Scope</uicontrol> of the list by selecting one of the
|
| 68 | following options:<ul>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 69 | <li><uicontrol>Workspace</uicontrol>. Lists all of the types available in
|
| 70 | your workspace. </li>
|
| 71 | <li><uicontrol>Enclosing Project</uicontrol>. Lists all of the types available
|
| 72 | in the project that contains your file. </li>
|
| 73 | <li>(Default) <uicontrol>Current Resource</uicontrol>. List all of the types
|
| 74 | available in your current file.</li>
|
| 75 | <li><uicontrol>Working Sets</uicontrol>. List all the types available within
|
| 76 | the selected working set.</li>
|
| 77 | </ul></info></step>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 78 | <step><cmd>If you selected <uicontrol>union</uicontrol> from the <uicontrol>Variety</uicontrol> list,
|
| 79 | click <uicontrol>Browse</uicontrol> <image href="../images/Browse.gif"><alt>This
|
| 80 | graphic is the Browse button</alt></image> next to the <uicontrol>Member types</uicontrol> field
|
| 81 | to specify the member types for the simple type.</cmd><info>You can select
|
| 82 | to add both <uicontrol>Built-in simple types</uicontrol> and <uicontrol>User-defined
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 83 | simple types</uicontrol> to the member types value list. </info></step>
|
| 84 | <step><cmd>Click the <uicontrol>Constraints</uicontrol> tab.</cmd><info>From
|
| 85 | here you will be able to set specific constraint values including length constraints,
|
| 86 | enumerations, and patterns. </info>
|
| 87 | <substeps>
|
| 88 | <substep><cmd>Enumerations help you to define a set of valid values for simple
|
| 89 | types. They are the actual values the simple type can take as valid values
|
| 90 | in the instance document. You can either add one enumeration or several enumerations
|
| 91 | at a time:</cmd><info><ul>
|
| 92 | <li>To add one enumeration at a time, under <uicontrol>Specific constraint
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 93 | values</uicontrol>, select <uicontrol>Enumerations</uicontrol> and click <uicontrol>Add</uicontrol> and
|
| 94 | specify a value for the enumeration.</li>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 95 | <li>To add several enumerations at one time, follow these steps:<ol>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 96 | <li>Select <uicontrol>Enumerations</uicontrol>.</li>
|
| 97 | <li>Click <uicontrol>Add</uicontrol>.</li>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 98 | <li>Enter the value of each enumeration. Each value must be separated by the <uicontrol>Delimiter
|
| 99 | character</uicontrol>. For example: <codeph>First, Second</codeph> will create
|
| 100 | two 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
|
| 102 | box if you want any white space around your enumeration values to be preserved.
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 103 | If you select this check box, the values of <codeph>First, Second</codeph> will
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 104 | show up as "First" and " Second" (there is a space before Second) because
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 105 | you put a space before "Second" when entering the value.</li>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 106 | <li>Click <uicontrol>OK</uicontrol>. Your enumerations will be created and
|
| 107 | appear in the Properties view.</li>
|
| 108 | </ol></li>
|
| 109 | </ul></info></substep>
|
| 110 | <substep><cmd>Patterns help you to place certain constraints regarding allowable
|
| 111 | values.</cmd><info>For example, you could restrict the field to only accept
|
| 112 | input which follows the pattern "five digits followed by two upper-case ASCII
|
| 113 | letters". To set a pattern constraint:<ol>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 114 | <li>Select <uicontrol>Patterns</uicontrol>.</li>
|
| 115 | <li>Click <uicontrol>Add</uicontrol>.</li>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 116 | <li>Create the regular expression pattern you wish to use as your constraint
|
| 117 | using 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
|
| 123 | to provide any information about this simple type.</cmd><info>The <uicontrol>Documentation</uicontrol> page
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 124 | is used for human readable material, such as a description.</info></step>
|
| 125 | <step><cmd>Click the <uicontrol>Extensions</uicontrol> tab if you want to
|
| 126 | add application information elements to your annotations of schema components.</cmd>
|
| 127 | <info>The <uicontrol>Extensions</uicontrol> page allows you to specify the
|
| 128 | schema and add XML content to your annotations.</info></step>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 129 | </steps>
|
| 130 | </taskbody>
|
| 131 | </task>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 132 | <?Pub *0000007829?>
|