Write an XML file by, first, creating a Document Object Model (DOM) node containing the XML data. Then, write the DOM node to an XML file. The final XML file should contain this text.
<?xml version="1.0" encoding="utf-8"?>
<toc version="2.0">
<tocitem target="upslope_product_page.html">Upslope Area Toolbox<!-- Functions -->
<tocitem target="demFlow_help.html">demFlow</tocitem>
<tocitem target="facetFlow_help.html">facetFlow</tocitem>
<tocitem target="flowMatrix_help.html">flowMatrix</tocitem>
<tocitem target="pixelFlow_help.html">pixelFlow</tocitem>
</tocitem>
</toc>
First, create the DOM node object and root element, and populate the elements and the attributes of the node corresponding to the XML data.
Identify the root element, and set the version
attribute.
Add the tocitem
element node for the product page. Each tocitem
element in this file has a target
attribute and a child text node.
Add comment.
Add a tocitem
element node for each function, where the target
is of the form function
_help.html
.
Finally, export the DOM node to an XML file named infoUAT.xml
, and view the file using the type
function.