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="taddglem" xml:lang="en-us">
|
| 7 | <title>Adding global elements</title>
|
| 8 | <titlealts>
|
| 9 | <searchtitle>Adding global elements</searchtitle>
|
| 10 | </titlealts>
|
| 11 | <shortdesc>A global element is an element with a global scope. It is one that
|
| 12 | has been declared as part of the main schema rather than as part of a content
|
| 13 | model.</shortdesc>
|
| 14 | <prolog><metadata>
|
kprice | 9623e9d | 2007-05-03 03:43:05 +0000 | [diff] [blame] | 15 | <keywords><indexterm>XML schema editor<indexterm>global elements</indexterm></indexterm>
|
| 16 | <indexterm>XML schema files<indexterm>global elements</indexterm></indexterm>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 17 | </keywords>
|
| 18 | </metadata></prolog>
|
| 19 | <taskbody>
|
| 20 | <context><p>The following instructions were written for the Resource perspective,
|
| 21 | but they will also work in many other perspectives.</p><p>To add a global
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 22 | element:</p></context>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 23 | <steps>
|
| 24 | <step><cmd>Open your XML schema in the XML schema editor.</cmd></step>
|
| 25 | <step><cmd>In the Outline view, select your schema.</cmd><info>The entire
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 26 | schema and its contents are displayed in the Design view.</info></step>
|
| 27 | <step><cmd>In the Design view, right-click in the <b>Elements</b> section
|
| 28 | and click <uicontrol>Add Element</uicontrol>.</cmd></step>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 29 | <step><cmd>In the Properties view, click the <uicontrol>General</uicontrol> tab,
|
| 30 | and type a new name for the global element in the <uicontrol>Name</uicontrol> field.</cmd>
|
| 31 | </step>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 32 | <step><cmd>In the Properties view, you can select the attribute type from
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 33 | the predefined list in the menu next to the <uicontrol>Type</uicontrol> field.</cmd>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 34 | <info><p>Alternatively, you can select <uicontrol>Browse</uicontrol> from
|
| 35 | the list for more options. </p><p>The <uicontrol>Set Type</uicontrol> dialog
|
| 36 | box appears, and lists all built-in and user-defined types currently available.
|
| 37 | You can change the <uicontrol>Scope</uicontrol> of the list by selecting one
|
| 38 | of the following options:<ul>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 39 | <li><uicontrol>Workspace</uicontrol>. Lists all of the types available in
|
| 40 | your workspace. </li>
|
| 41 | <li><uicontrol>Enclosing Project</uicontrol>. Lists all of the types available
|
| 42 | in the project that contains your file. </li>
|
| 43 | <li>(Default) <uicontrol>Current Resource</uicontrol>. List all of the types
|
| 44 | available in your current file.</li>
|
| 45 | <li><uicontrol>Working Sets</uicontrol>. List all the types available within
|
| 46 | the selected working set.</li>
|
| 47 | </ul></p><p>Select the type you want in the type list, then click <uicontrol>OK</uicontrol>. </p></info>
|
| 48 | </step>
|
| 49 | <step><cmd>(Optional) Click the <uicontrol>Other</uicontrol> tab.</cmd><info>In
|
| 50 | this page, you can specify the following various values for the global element: </info>
|
| 51 | <choices>
|
| 52 | <choice><uicontrol>abstract</uicontrol>. Click <b>true </b>if you want the
|
| 53 | global element to be abstract. When a global element is declared to be abstract,
|
| 54 | it cannot be used in an instance document. Instead, a member of that global
|
| 55 | element's substitution group must appear in the instance document.</choice>
|
| 56 | <choice><uicontrol>block</uicontrol>. This field determines whether the global
|
| 57 | element may be replaced by an element derived from it.</choice>
|
| 58 | <choice><uicontrol>final</uicontrol>. This field determines whether this global
|
| 59 | element may be derived from.</choice>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 60 | <choice><uicontrol>fixed/default</uicontrol>. Click <uicontrol>Browse</uicontrol> and
|
| 61 | select <uicontrol>Fixed</uicontrol> or <uicontrol>Default</uicontrol> and
|
| 62 | specify an appropriate value. If you select <b>Fixed</b>, the global element
|
| 63 | has a fixed value, which cannot be changed. If you select <b>Default</b>,
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 64 | the element has a default value.</choice>
|
| 65 | <choice><uicontrol>form</uicontrol>. Use this field to indicate if the appearance
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 66 | of this global element in an instance of the XML schema (an XML file associated
|
| 67 | with the XML schema) must be qualified by a namespace.</choice>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 68 | <choice><uicontrol>nillable</uicontrol>. Select <b>true</b> if you do not
|
| 69 | want the global element to be able to have any child elements, only attributes. </choice>
|
| 70 | <choice><uicontrol>substitutionGroup</uicontrol>. A substitution group allows
|
| 71 | elements to be substituted for other elements.</choice>
|
| 72 | </choices>
|
| 73 | </step>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 74 | <step><cmd>Click the <uicontrol>Attributes</uicontrol> tab.</cmd><info>You
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 75 | can use this page to add attributes, attribute references, attributes group
|
| 76 | references, and <codeph>any</codeph> attributes to your global element.</info>
|
| 77 | </step>
|
| 78 | <step><cmd>An attribute associates an attribute name with a specific type
|
| 79 | and value. To add an attribute, right-click in the Attributes page, and click <uicontrol>Add
|
| 80 | Attribute</uicontrol>.</cmd><info>You can specify the following values for
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 81 | an attribute:</info>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 82 | <choices>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 83 | <choice><uicontrol>fixed/default</uicontrol>. Click <uicontrol>Browse</uicontrol> and
|
| 84 | select <uicontrol>Fixed</uicontrol> or <uicontrol>Default</uicontrol> and
|
| 85 | specify an appropriate value. If you select <b>Fixed</b>, the attribute has
|
| 86 | a fixed value, which cannot be changed. If you select <b>Default</b>, the
|
| 87 | attribute has a default value.</choice>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 88 | <choice><uicontrol>form</uicontrol>. Use this field to indicate if the appearance
|
| 89 | of this attribute in an instance of the XML schema must be qualified by a
|
| 90 | namespace.</choice>
|
| 91 | <choice><uicontrol>name</uicontrol>. Enter the name of the attribute.</choice>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 92 | <choice><uicontrol>type</uicontrol>. Click <uicontrol>Browse</uicontrol> and
|
| 93 | select the type of the attribute. </choice>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 94 | <choice><uicontrol>use</uicontrol>. This field indicates how an attribute
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 95 | can be used in an instance document. If you select optional, the attribute
|
| 96 | can appear once, but it does not have to. If you select required, the attribute
|
| 97 | must appear once. If you select prohibited, the attribute must not appear. <b>Note</b>:
|
| 98 | If you selected <uicontrol>Default</uicontrol>, you must select <b>optional</b> in
|
| 99 | this field, otherwise the default value will not be valid.</choice>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 100 | </choices>
|
| 101 | </step>
|
| 102 | <step><cmd>An attribute reference provides a reference to a global attribute.
|
| 103 | To add an attribute reference, right-click in the Attributes page, and click <uicontrol>Add
|
| 104 | Attribute Ref</uicontrol>.</cmd><info>A declaration that references a global
|
| 105 | attribute enables the referenced attribute to appear in the instance document
|
| 106 | in the context of the referencing declaration. The menu option to add an attribute
|
| 107 | reference only appears if there are global attributes defined elsewhere in
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 108 | the document. Select the reference, then select the global attribute you want
|
| 109 | it to reference from the <uicontrol>ref</uicontrol> list.</info></step>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 110 | <step><cmd>An attribute group reference provides a reference to an attribute
|
| 111 | group. To add an attribute group reference, right-click in the Attributes
|
| 112 | page, and click <uicontrol>Add Attribute Group Ref</uicontrol>.</cmd><info>A
|
| 113 | declaration that references an attribute group enables the referenced attribute
|
| 114 | group to appear in the instance document in the context of the referencing
|
| 115 | declaration. The menu option to add an attribute group reference only appears
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 116 | if there are attribute groups defined elsewhere in the document. Select the
|
| 117 | reference, then select the attribute group you want it to reference from the <uicontrol>ref</uicontrol> list.</info>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 118 | </step>
|
| 119 | <step><cmd>An <codeph>any</codeph> element enables element content according
|
| 120 | to namespaces, and the corresponding <codeph>any</codeph> attribute element
|
| 121 | enables attributes to appear in elements. To add an <codeph>any</codeph> attribute,
|
| 122 | right-click in the Attributes page and click <uicontrol>Add Any Attribute</uicontrol>.</cmd>
|
| 123 | <info>You can specify the following values for an <codeph>any</codeph> attribute:</info>
|
| 124 | <choices>
|
kprice | 9623e9d | 2007-05-03 03:43:05 +0000 | [diff] [blame] | 125 | <choice>For a <uicontrol>namespace</uicontrol> value, you can
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 126 | select:<ul>
|
| 127 | <li><b>##any</b>. This allows any well-formed XML from any namespace.</li>
|
| 128 | <li><b>##local </b>. This allows any well-formed XML that is not declared
|
| 129 | to be in a namespace.</li>
|
| 130 | <li><b>##other</b>. This allows any well-formed XML that is not from the target
|
| 131 | namespace of the type being defined.</li>
|
| 132 | <li><b>##targetNamespace </b>. This is shorthand for the target namespace
|
| 133 | of the type being defined.</li>
|
| 134 | </ul></choice>
|
| 135 | <choice>For a <uicontrol>processContents</uicontrol> value, you can select:<ul>
|
| 136 | <li><b>skip</b>. The XML processor will not validate the attribute content
|
| 137 | at all.</li>
|
| 138 | <li><b>lax</b>. The XML processor will validate the attribute content as much
|
| 139 | as it can.</li>
|
| 140 | <li><b>strict</b>. The XML processor will validate all the attribute content.</li>
|
| 141 | </ul></choice>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 142 | </choices>
|
| 143 | </step>
|
| 144 | <step><cmd>Click the <uicontrol>Documentation</uicontrol> tab if you want
|
| 145 | to provide any information about this global element.</cmd><info>The <uicontrol>Documentation</uicontrol> page
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 146 | is used for human readable material, such as a description.</info></step>
|
| 147 | <step><cmd>Click the <uicontrol>Extensions</uicontrol> tab if you want to
|
| 148 | add application information elements to your annotations of schema components.</cmd>
|
| 149 | <info>The <uicontrol>Extensions</uicontrol> page allows you to specify the
|
| 150 | schema and add XML content to your annotations.</info></step>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 151 | </steps>
|
| 152 | <postreq>You can add a content model to a global element, which is the representation
|
| 153 | of any data that can be contained inside the global element. For more information
|
| 154 | about working with content models, refer to the related tasks.</postreq>
|
| 155 | </taskbody>
|
| 156 | </task>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 157 | <?Pub *0000009579?>
|