Example using XSDL hints
During the XML Schema import process, when you select a value other than "None" for the XSDL Hints Location, extra steps are required if the actual value of the XSDL Hints are required in the output.
- From the Type Designer Startup window, select
Import a type tree and click OK.
The Importer Wizard is displayed.
- Select XML Schema and click Next.
- Select the following example file and click
Next:
install_dir\examples\xml\ipo.xsd
- At the prompt to specify a national language, accept the default (Western) and click Next.
- In the Filename field, enter a filename and
path for the type tree (.mtt) you are about to create. For
example, enter:
install_dir\examples\xml\ipo_global_elements.mtt
- Under Validation, select Xerces.
- For the XSDL Hints Location, select Global Elements.
- Click Next.
- When type tree generation is complete, click
Finish and open the type tree.
All global types contain at least two optional text items in their AttrList group (to which values can be assigned in a map as map rules): xsi~noNamespaceSchemaLocation and xsi~schemaLocation.
- Using the Map Designer, open the following example map:
install_dir \examples\xml\ipo.mms
- Update the input and output cards of validationMap with the ipo_global_elements.mtt type tree.
- In the output card, delete the existing rule: Output = Input.
- Enter new map rules in the output card. The xsi~schemaLocation attribute should be equal to http://www.example.com/IPO ipo.xsd.
This rule causes the output document to contain the schemaLocation XSDL hint (http://www.example.com/IPO ipo.xsd).
<ipo-out:purchaseOrders
xmlns:ipo-out="http://www.example.com/IPO"
xsi:schemaLocation="http://www.example.com/IPO ipo.xsd">
See the Map Designer documentation for information about how to add XSDL hints to an output card when you are using native XML schema validation instead of type trees and Xerces validation.
When a namespace is not declared in an input schema, you must manually define it in the output card. See "To add a namespace to the output card" for instructions.