kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 2 | <!--Arbortext, Inc., 1988-2006, v.4002-->
|
| 3 | <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN"
|
| 4 | "task.dtd">
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 5 | <?Pub Inc?>
|
| 6 | <task id="tcrexxsd" xml:lang="en-us">
|
| 7 | <title>Generating XML files from XML schemas</title>
|
| 8 | <titlealts>
|
| 9 | <searchtitle>Generating an XML file from an XML schema</searchtitle>
|
| 10 | </titlealts>
|
| 11 | <shortdesc>You can generate an XML file from your XML schema if you want to
|
| 12 | quickly create an XML file based on your XML schema file. Generating an XML
|
| 13 | file from your XML schema saves you time by creating an XML file that is already
|
| 14 | associated with your XML schema, and contains at least some of the elements
|
| 15 | and attributes in your XML schema.</shortdesc>
|
| 16 | <prolog><metadata>
|
| 17 | <keywords><indexterm>XML files<indexterm>generating from XML schemas</indexterm></indexterm>
|
kprice | 9623e9d | 2007-05-03 03:43:05 +0000 | [diff] [blame] | 18 | <indexterm>XML schemas<indexterm>generating XML files</indexterm></indexterm>
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 19 | </keywords>
|
| 20 | </metadata></prolog>
|
| 21 | <taskbody>
|
| 22 | <context><p>After you have generated your XML file, you can further customize
|
| 23 | it in the XML editor.</p><p>The following instructions were written for the
|
| 24 | Resource perspective, but they will also work in many other perspectives.</p><p>To
|
| 25 | generate an XML file from a schema file follow these steps:</p></context>
|
| 26 | <steps>
|
| 27 | <step><cmd>In the Navigator view, right-click the XML schema file that you
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 28 | want to work with and select <menucascade><uicontrol>Generate</uicontrol>
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 29 | <uicontrol>XML File</uicontrol></menucascade>.</cmd></step>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 30 | <step><cmd>Select a project or folder to contain the XML file and type a name
|
| 31 | for the file in the <uicontrol>File Name</uicontrol> field, then click <uicontrol>Next</uicontrol>.</cmd>
|
| 32 | <info>The name of the file must end in <userinput>.xml</userinput>.</info>
|
| 33 | </step>
|
| 34 | <step><cmd>Select the <uicontrol>Root element</uicontrol> of the XML file.</cmd>
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 35 | <info>The root element of an XML file is the element that contains all other
|
| 36 | elements in that file. All of the global elements you have defined in the
|
| 37 | XML schema will be included in the Root element list. If you do not have any
|
| 38 | global elements in your XML schema, you cannot create an XML file from it.</info>
|
| 39 | </step>
|
| 40 | <step><cmd>Select from the following content options:</cmd>
|
| 41 | <choices>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 42 | <choice><uicontrol>Create optional attributes</uicontrol>: both mandatory
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 43 | and optional attributes will be generated.</choice>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 44 | <choice><uicontrol>Create optional elements</uicontrol>: both mandatory and
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 45 | optional elements will be generated.</choice>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 46 | <choice><uicontrol>Create first choice of required choice</uicontrol>: the
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 47 | first option of a required choice will be generated in your XML file.</choice>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 48 | <choice><uicontrol>Fill elements and attributes with data</uicontrol>: any
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 49 | elements and attributes generated will be filled with sample data.</choice>
|
| 50 | </choices>
|
| 51 | <info>If you do not select any of these options, then only the minimum amount
|
| 52 | of content required for the XML file will be created.</info></step>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 53 | <step><cmd>The Namespace Information section contains information about the
|
| 54 | target namespace of the XML schema, its prefix, and the schema location. Select
|
| 55 | the entry you want to edit and click <uicontrol>Edit</uicontrol>.</cmd><info><ul>
|
| 56 | <li>The value in the <uicontrol>Namespace Name</uicontrol> field is the target
|
| 57 | namespace of the XML schema. Your XML file should be associated with the same
|
| 58 | namespace as its XML schema is associated with.</li>
|
| 59 | <li>All qualified elements and attributes in the XML file associated with
|
| 60 | the namespace will be prefixed with the <uicontrol>Prefix</uicontrol> value.</li>
|
| 61 | <li>The <uicontrol>Location Hint</uicontrol> field contains the location
|
| 62 | of the XML schema.</li>
|
| 63 | </ul>For more information about namespaces and namespace prefixes, refer to
|
| 64 | the related references.</info></step>
|
| 65 | <step><cmd>Click <uicontrol>OK</uicontrol> and then <uicontrol>Finish</uicontrol>.</cmd>
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 66 | </step>
|
| 67 | </steps>
|
| 68 | <result><p>The XML file will contain the selected root element and any elements
|
| 69 | or attributes contained in the root element. It also contains information
|
| 70 | about the XML file namespace and location. You can now add elements and attributes
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 71 | to the XML file.</p><note>In certain cases, when an XML file is generated
|
| 72 | from a complex XML schema file, the XML file might not be valid. If this occurs,
|
| 73 | you can open the generated file in the XML editor and correct any errors that
|
| 74 | occur. Usually, only a few errors need to be fixed. The following XML schema
|
| 75 | constructs might present problems:</note><ul><?Pub Caret?>
|
| 76 | <li>Restrictions: sometimes restricted elements are erroneously generated. </li>
|
| 77 | <li>Facets: default generated data values might not conform to complex facets
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 78 | (for example, patterns).</li>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 79 | <li>Abstract elements: abstract elements are sometimes erroneously generated.</li>
|
| 80 | </ul></result>
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 81 | </taskbody>
|
| 82 | </task>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 83 | <?Pub *0000004762?>
|