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