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="taddcmxt" xml:lang="en-us">
|
| 7 | <title>Adding complex types</title>
|
| 8 | <titlealts>
|
| 9 | <searchtitle>Adding complex types</searchtitle>
|
| 10 | </titlealts>
|
| 11 | <shortdesc>A complex type allows elements in its content and can carry attributes.
|
| 12 | Complex types can be used to help determine the appropriate content for any
|
| 13 | instance documents generated from or associated with your XML schema.</shortdesc>
|
| 14 | <prolog><metadata>
|
kprice | 9623e9d | 2007-05-03 03:43:05 +0000 | [diff] [blame] | 15 | <keywords><indexterm>XML schema editor<indexterm>complex types</indexterm></indexterm>
|
| 16 | <indexterm>XML schema files<indexterm>complex types</indexterm></indexterm>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 17 | </keywords>
|
| 18 | </metadata></prolog>
|
| 19 | <taskbody>
|
| 20 | <context><p>You can add as many complex types as you want to an XML schema.</p><p>The
|
| 21 | following instructions were written for the Resource perspective, but they
|
| 22 | will also work in many other perspectives.</p><p>To add a complex type to
|
| 23 | an XML schema, follow these steps:</p></context>
|
| 24 | <steps>
|
| 25 | <step><cmd>Open your XML schema in the XML schema editor.</cmd></step>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 26 | <step><cmd>Right-click the Types category in the Design view, and click <uicontrol>Add
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 27 | Complex Type</uicontrol>.</cmd></step>
|
| 28 | <step><cmd>In the Properties view, type a new name for the complex type in
|
| 29 | the <uicontrol>Name</uicontrol> field.</cmd></step>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 30 | <step><cmd>Click <uicontrol>Browse</uicontrol> <image href="../images/Browse.gif">
|
| 31 | <alt>Browse icon</alt></image> to select a base type for your complex type.</cmd>
|
| 32 | <info>You can either set a base type for your complex type, or you can add
|
| 33 | a content model to it (which represents any data that can be contained inside
|
| 34 | an element), but you cannot do both. For more information about content models,
|
| 35 | refer to the related tasks.</info></step>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 36 | <step><cmd>Select <uicontrol>restriction</uicontrol> or <uicontrol>extension</uicontrol> from
|
| 37 | the <uicontrol>Inherited by</uicontrol> list.</cmd><info>This specifies whether
|
| 38 | your type is derived from its base type by restriction or extension.</info>
|
| 39 | </step>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 40 | <step><cmd>The Design view will display the attributes within the complex
|
| 41 | type.</cmd><info>You can also use this view to add attributes to your complex
|
| 42 | type. An attribute associates an attribute name with a specific type and value.</info>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 43 | <choices>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 44 | <choice>To add an attribute, in the Design view, right click your complex
|
| 45 | type and select <uicontrol>Add Attribute</uicontrol>.<ul>
|
| 46 | <li><uicontrol>name</uicontrol>. In the Design view, click the name of the
|
| 47 | attribute to make a change.</li>
|
| 48 | <li><uicontrol>type</uicontrol>. In the Design view, click the type of the
|
| 49 | attribute to make a change. The drop-down menu provides commonly used types.
|
| 50 | For more options, simply select <uicontrol>Browse</uicontrol> from the menu.</li>
|
| 51 | </ul></choice>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 52 | </choices>
|
| 53 | </step>
|
| 54 | <step><cmd>An attribute reference provides a reference to a global attribute.
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 55 | To add an attribute reference, in the Design view, right-click the complex
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 56 | type containing the element, and click <uicontrol>Add Attribute Ref</uicontrol>.</cmd>
|
| 57 | <info>A declaration that references a global attribute enables the referenced
|
| 58 | attribute to appear in the instance document in the context of the referencing
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 59 | declaration. Select the reference, then select the attribute group you want
|
| 60 | it to reference in the Properties view, from the<uicontrol> Ref</uicontrol> menu.</info>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 61 | </step>
|
| 62 | <step><cmd>An attribute group reference provides a reference to an attribute
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 63 | group. To add an attribute group reference, in the Design view, right-click
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 64 | the complex type containing the element, and click <uicontrol>Add Attribute
|
| 65 | Group Ref</uicontrol>.</cmd><info>A declaration that references an attribute
|
| 66 | group enables the referenced attribute group to appear in the instance document
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 67 | in the context of the referencing declaration. Select the reference, then
|
| 68 | select the attribute group you want it to reference in the Properties view,
|
| 69 | from the<uicontrol> Ref</uicontrol> menu.</info></step>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 70 | <step><cmd>An <codeph>any</codeph> element enables element content according
|
| 71 | to namespaces, and the corresponding <codeph>any</codeph> attribute element
|
| 72 | enables attributes to appear in elements. To add an <codeph>any</codeph> attribute,
|
| 73 | right-click in the complex type header, and click <uicontrol>Add Any Attribute</uicontrol>.</cmd>
|
| 74 | <info>You can specify the following values for an <codeph>any</codeph> attribute:</info>
|
| 75 | <choices>
|
kprice | 9623e9d | 2007-05-03 03:43:05 +0000 | [diff] [blame] | 76 | <choice>For a <uicontrol>namespace</uicontrol> value, you can
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 77 | select:<ul>
|
| 78 | <li><b>##any</b>. This allows any well-formed XML from any namespace.</li>
|
| 79 | <li><b>##local </b>. This allows any well-formed XML that is not declared
|
| 80 | to be in a namespace.</li>
|
| 81 | <li><b>##other</b>. This allows any well-formed XML that is not from the target
|
| 82 | namespace of the type being defined.</li>
|
| 83 | <li><b>##targetNamespace </b>. This is shorthand for the target namespace
|
| 84 | of the type being defined.</li>
|
| 85 | </ul></choice>
|
| 86 | <choice>For a <uicontrol>processContents</uicontrol> value, you can select:<ul>
|
| 87 | <li><b>skip</b>. The XML processor will not validate the attribute content
|
| 88 | at all.</li>
|
| 89 | <li><b>lax</b>. The XML processor will validate the attribute content as much
|
| 90 | as it can.</li>
|
| 91 | <li><b>strict</b>. The XML processor will validate all the attribute content.</li>
|
| 92 | </ul></choice>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 93 | </choices>
|
| 94 | <info></info></step>
|
| 95 | <step><cmd>Click the <uicontrol>Documentation</uicontrol> tab if you want
|
| 96 | to provide any information about this complex type.</cmd><info>The <uicontrol>Documentation</uicontrol> page
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 97 | is used for human readable material, such as a description.</info></step>
|
| 98 | <step><cmd>Click the <uicontrol>Extensions</uicontrol> tab if you want to
|
| 99 | add application information elements to your annotations of schema components.</cmd>
|
| 100 | <info>The <uicontrol>Extensions</uicontrol> page allows you to specify the
|
| 101 | schema and add XML content to your annotations.</info></step>
|
kprice | 159fa58 | 2006-05-08 21:30:45 +0000 | [diff] [blame] | 102 | </steps>
|
| 103 | </taskbody>
|
| 104 | </task>
|
kprice | 647b735 | 2006-05-17 21:27:16 +0000 | [diff] [blame] | 105 | <?Pub *0000006207?>
|