When XSDL hints are required in output
During the XML Schema import process, when you do not accept the default XSDL Hints Location setting (None), the following choices are listed:
- All Elements: Creates XSDL hints placeholders for all types described by the XML Schema.
- Global Element: Creates XSDL hints placeholders for all global elements.
- Root Element: Do not use.
When the actual value of the XSDL hint is required in the output, you must follow specific instructions.
For example, during the import process you select Global Element for the XSDL Hints Location value. In the generated type tree, all global types (represented in the type tree as components of the XSD Element category) contain in their AttrList group at least two optional text items: xsi~noNamespaceSchemaLocation and xsi~schemaLocation.
For either of these items, you can create a map rule that sends the XSDL hint to the output. For example, when a map rules sends the schemaLocation XSDL hint to the output, the output looks similar to:
<ipo-out:purchaseOrders
xmlns:ipo-out="http://www.example.com/IPO"
xsi:schemaLocation="http://www.example.com/IPO ipo.xsd">
When the http://www.w3.org/2001/XMLSchema-instance namespace is not declared in the input XML Schema, you must manually add the definition in the output card.
To add a namespace to the output card:
- Open the output card.
- Expand the Type setting.
- Under Schema is a list of the namespaces identified in the input Schema.
- Right-click the Name Spaces setting and choose Add from the context menu.
- On the new line, enter http://www.w3.org/2001/XMLSchema-instance in the Setting column and xsi in the Value column and click OK.
- Save, build, and run the map.
The resulting XML document has a header that looks similar to the following text:
<?xml version="1.0"?> <ipo-out:purchaseOrders xmlns:ipo-out="http://www.example.com/IPO" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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.