Editing DAD files
You may want to edit a DAD file if you have moved your document type definition (DTD) file, or need to otherwise modify the output of the DAD Generator.
To open your DAD file in the default editor, double-click the file in the Navigator view. The editor provides basic functions like highlighting and find and replace.
You may wish to modify the following nodes:
- To change the location of the DTD file for the generated DAD document, update the SYSTEM ID in the DAD document type definition.
- To change the location of the DTD file for the XML target document, update the text for the DAD dtdid element along with the text for the DAD doctype element which specifies the XML document type definition.
- If the XML document is to be validated with the DTD for the DAD, specify YES in the validation element. Note that in the current version, the generated DAD script always specifies NO for the validation element.
- To preserve the order of a document containing elements or attributes with multiple occurrence back to their original structure, add an orderBy attribute to the pertinent table elements in the RDB_node of the top element_node. Note in the current version of the generated DAD script, the orderBy attribute on a table element is not generated.
Consider the following code sample:
<?xml version ="1.0"?> <!DOCTYPE DAD SYSTEM "/home/dxxinst/dtd/dad.dtd"> <DAD> <dtdid>/home/samples/dtd/neworder.dtd</dtdid> <validation>NO</validation> <Xcollection> <prolog>?xml version="1.0"?</prolog> <doctype>!DOCTYPE Order SYSTEM "/home/samples/dtd/neworder.dtd"</doctype> <root_node> <element_node name="Order"> <RDB_node> <table name="order_tab" key="order_key1 order_key2 order_key3"/> <table name="part_tab" key="part_key1 part_key2"/> <table name="ship_tab" key="date"/> <condition>order_tab.order_key1= order_tab.order_key1</condition> </RDB_node> . . .The following table explains how to edit the code:
Code Modification <!DOCTYPE DAD SYSTEM "/home/dxxinst/dtd/dad.dtd"> Modify this line to change the location of the DTD file for the DAD document. <dtdid>/home/samples/dtd/neworder.dtd</dtd> <doctype>!DOCTYPE Order SYSTEM "/home/samples/dtd/neworder.dtd"</doctype>
Modify these lines to change the location of the DTD file for the XML document. <validation>NO</validation> Modify this line to change the validation indicator. <element_node name="Order"> Modify this line to change the top element representing the root XML element. <table name="order_tab" key="order_key1 order_key2 order_key3"/>
<table name="part_tab" key="part_key1 part_key2"/>
<table name="ship_tab" key="date"/>Modify these lines to add an orderBy attribute to the table element.
Parent topic
Generating DAD files
Related concepts
DAD script
Related tasks
Generating DAD files
Running DAD files with the DB2 XML Extender
Related reference
The generated DAD script