blob: 1dfe97d20753b4924c769995c4de0f7510c04164 [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="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
12has been declared as part of the main schema rather than as part of a content
13model.</shortdesc>
14<prolog><metadata>
kprice9623e9d2007-05-03 03:43:05 +000015<keywords><indexterm>XML schema editor<indexterm>global elements</indexterm></indexterm>
16<indexterm>XML schema files<indexterm>global elements</indexterm></indexterm>
kprice159fa582006-05-08 21:30:45 +000017</keywords>
18</metadata></prolog>
19<taskbody>
20<context><p>The following instructions were written for the Resource perspective,
21but they will also work in many other perspectives.</p><p>To add a global
kprice647b7352006-05-17 21:27:16 +000022element:</p></context>
kprice159fa582006-05-08 21:30:45 +000023<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
kprice647b7352006-05-17 21:27:16 +000026schema 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
28and click <uicontrol>Add Element</uicontrol>.</cmd></step>
kprice159fa582006-05-08 21:30:45 +000029<step><cmd>In the Properties view, click the <uicontrol>General</uicontrol> tab,
30and type a new name for the global element in the <uicontrol>Name</uicontrol> field.</cmd>
31</step>
kprice647b7352006-05-17 21:27:16 +000032<step><cmd>In the Properties view, you can select the attribute type from
kprice159fa582006-05-08 21:30:45 +000033the predefined list in the menu next to the <uicontrol>Type</uicontrol> field.</cmd>
kprice647b7352006-05-17 21:27:16 +000034<info><p>Alternatively, you can select <uicontrol>Browse</uicontrol> from
35the list for more options. </p><p>The <uicontrol>Set Type</uicontrol> dialog
36box appears, and lists all built-in and user-defined types currently available.
37You can change the <uicontrol>Scope</uicontrol> of the list by selecting one
38of the following options:<ul>
kprice159fa582006-05-08 21:30:45 +000039<li><uicontrol>Workspace</uicontrol>. Lists all of the types available in
40your workspace. </li>
41<li><uicontrol>Enclosing Project</uicontrol>. Lists all of the types available
42in the project that contains your file. </li>
43<li>(Default) <uicontrol>Current Resource</uicontrol>. List all of the types
44available in your current file.</li>
45<li><uicontrol>Working Sets</uicontrol>. List all the types available within
46the 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
50this 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
53global element to be abstract. When a global element is declared to be abstract,
54it cannot be used in an instance document. Instead, a member of that global
55element's substitution group must appear in the instance document.</choice>
56<choice><uicontrol>block</uicontrol>. This field determines whether the global
57element may be replaced by an element derived from it.</choice>
58<choice><uicontrol>final</uicontrol>. This field determines whether this global
59element may be derived from.</choice>
kprice647b7352006-05-17 21:27:16 +000060<choice><uicontrol>fixed/default</uicontrol>. Click <uicontrol>Browse</uicontrol> and
61select <uicontrol>Fixed</uicontrol> or <uicontrol>Default</uicontrol> and
62specify an appropriate value. If you select <b>Fixed</b>, the global element
63has a fixed value, which cannot be changed. If you select <b>Default</b>,
kprice159fa582006-05-08 21:30:45 +000064the element has a default value.</choice>
65<choice><uicontrol>form</uicontrol>. Use this field to indicate if the appearance
kprice647b7352006-05-17 21:27:16 +000066of this global element in an instance of the XML schema (an XML file associated
67with the XML schema) must be qualified by a namespace.</choice>
kprice159fa582006-05-08 21:30:45 +000068<choice><uicontrol>nillable</uicontrol>. Select <b>true</b> if you do not
69want the global element to be able to have any child elements, only attributes. </choice>
70<choice><uicontrol>substitutionGroup</uicontrol>. A substitution group allows
71elements to be substituted for other elements.</choice>
72</choices>
73</step>
kprice647b7352006-05-17 21:27:16 +000074<step><cmd>Click the <uicontrol>Attributes</uicontrol> tab.</cmd><info>You
kprice159fa582006-05-08 21:30:45 +000075can use this page to add attributes, attribute references, attributes group
76references, 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
79and value. To add an attribute, right-click in the Attributes page, and click <uicontrol>Add
80Attribute</uicontrol>.</cmd><info>You can specify the following values for
kprice647b7352006-05-17 21:27:16 +000081an attribute:</info>
kprice159fa582006-05-08 21:30:45 +000082<choices>
kprice647b7352006-05-17 21:27:16 +000083<choice><uicontrol>fixed/default</uicontrol>. Click <uicontrol>Browse</uicontrol> and
84select <uicontrol>Fixed</uicontrol> or <uicontrol>Default</uicontrol> and
85specify an appropriate value. If you select <b>Fixed</b>, the attribute has
86a fixed value, which cannot be changed. If you select <b>Default</b>, the
87attribute has a default value.</choice>
kprice159fa582006-05-08 21:30:45 +000088<choice><uicontrol>form</uicontrol>. Use this field to indicate if the appearance
89of this attribute in an instance of the XML schema must be qualified by a
90namespace.</choice>
91<choice><uicontrol>name</uicontrol>. Enter the name of the attribute.</choice>
kprice647b7352006-05-17 21:27:16 +000092<choice><uicontrol>type</uicontrol>. Click <uicontrol>Browse</uicontrol> and
93select the type of the attribute. </choice>
kprice159fa582006-05-08 21:30:45 +000094<choice><uicontrol>use</uicontrol>. This field indicates how an attribute
kprice647b7352006-05-17 21:27:16 +000095can be used in an instance document. If you select optional, the attribute
96can appear once, but it does not have to. If you select required, the attribute
97must appear once. If you select prohibited, the attribute must not appear. <b>Note</b>:
98If you selected <uicontrol>Default</uicontrol>, you must select <b>optional</b> in
99this field, otherwise the default value will not be valid.</choice>
kprice159fa582006-05-08 21:30:45 +0000100</choices>
101</step>
102<step><cmd>An attribute reference provides a reference to a global attribute.
103To add an attribute reference, right-click in the Attributes page, and click <uicontrol>Add
104Attribute Ref</uicontrol>.</cmd><info>A declaration that references a global
105attribute enables the referenced attribute to appear in the instance document
106in the context of the referencing declaration. The menu option to add an attribute
107reference only appears if there are global attributes defined elsewhere in
kprice647b7352006-05-17 21:27:16 +0000108the document. Select the reference, then select the global attribute you want
109it to reference from the <uicontrol>ref</uicontrol> list.</info></step>
kprice159fa582006-05-08 21:30:45 +0000110<step><cmd>An attribute group reference provides a reference to an attribute
111group. To add an attribute group reference, right-click in the Attributes
112page, and click <uicontrol>Add Attribute Group Ref</uicontrol>.</cmd><info>A
113declaration that references an attribute group enables the referenced attribute
114group to appear in the instance document in the context of the referencing
115declaration. The menu option to add an attribute group reference only appears
kprice647b7352006-05-17 21:27:16 +0000116if there are attribute groups defined elsewhere in the document. Select the
117reference, then select the attribute group you want it to reference from the <uicontrol>ref</uicontrol> list.</info>
kprice159fa582006-05-08 21:30:45 +0000118</step>
119<step><cmd>An <codeph>any</codeph> element enables element content according
120to namespaces, and the corresponding <codeph>any</codeph> attribute element
121enables attributes to appear in elements. To add an <codeph>any</codeph> attribute,
122right-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>
kprice9623e9d2007-05-03 03:43:05 +0000125<choice>For a <uicontrol>namespace</uicontrol> value, you can
kprice647b7352006-05-17 21:27:16 +0000126select:<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
129to be in a namespace.</li>
130<li><b>##other</b>. This allows any well-formed XML that is not from the target
131namespace of the type being defined.</li>
132<li><b>##targetNamespace </b>. This is shorthand for the target namespace
133of 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
137at all.</li>
138<li><b>lax</b>. The XML processor will validate the attribute content as much
139as it can.</li>
140<li><b>strict</b>. The XML processor will validate all the attribute content.</li>
141</ul></choice>
kprice159fa582006-05-08 21:30:45 +0000142</choices>
143</step>
144<step><cmd>Click the <uicontrol>Documentation</uicontrol> tab if you want
145to provide any information about this global element.</cmd><info>The <uicontrol>Documentation</uicontrol> page
kprice647b7352006-05-17 21:27:16 +0000146is used for human readable material, such as a description.</info></step>
147<step><cmd>Click the <uicontrol>Extensions</uicontrol> tab if you want to
148add application information elements to your annotations of schema components.</cmd>
149<info>The <uicontrol>Extensions</uicontrol> page allows you to specify the
150schema and add XML content to your annotations.</info></step>
kprice159fa582006-05-08 21:30:45 +0000151</steps>
152<postreq>You can add a content model to a global element, which is the representation
153of any data that can be contained inside the global element. For more information
154about working with content models, refer to the related tasks.</postreq>
155</taskbody>
156</task>
kprice647b7352006-05-17 21:27:16 +0000157<?Pub *0000009579?>