The following code does not work. // <company> // <product>Xerces-C</product> // <category idea='great'>XML Parsing Tools</category> // <developedBy>Apache Software Foundation</developedBy> // </company>
DOM_DOMImplementation impl; DOM_Document doc = impl.createDocument( 0, // root element namespace URI. "company", // root element name DOM_DocumentType()); // document type object (DTD). DOM_Element rootElem = doc.getDocumentElement(); DOM_Element prodElem = doc.createElement("product"); rootElem.appendChild(prodElem); DOM_Text prodDataVal = doc.createTextNode("Xerces-C"); prodElem.appendChild(prodDataVal); DOM_Element catElem = doc.createElement("category"); rootElem.appendChild(catElem); catElem.setAttribute("idea", "great"); DOM_Text catDataVal = doc.createTextNode("XML Parsing Tools"); catElem.appendChild(catDataVal); DOM_Element devByElem = doc.createElement("developedBy"); rootElem.appendChild(devByElem); DOM_Text devByDataVal = doc.createTextNode("Apache Software Foundation"); devByElem.appendChild(devByDataVal); // // Now count the number of elements in the above DOM tree. // unsigned int elementCount = doc.getElementsByTagName("*").getLength(); cout << "The tree just created contains: " << elementCount << " elements." << endl; // // The DOM document and its contents are reference counted, and need // no explicit deletion. // return 0; } I was trying to use the above example to create a dom document in code. However, this code crashed when I tried to run it. Upon digging a little deeper it appears that some of the functions required by the above code snippet are not implemented within the xerces toolkit. Another employee at my company downloaded the source and compiled it on our system. We are running OpenVMS and he implemented the necessary headers to port the code to VMS and utilize the approach you took to platform independence. The version that was used was 1.0.0. Thank you, Marcus C. Oladell Factset Research Systems One Cummings Point Road Stamford, CT 06902 (203) 356-3774