You're using the right calls, you just need to make sure you create everything with the right values. For example:
<?xml version="1.0"?> <foo:bar xmlns:foo="http://xml.apache.org/xalan-c" foo:attr="value"/> DOM_DOMImplementation impl; DOM_Document doc = impl.createDocument( "http://xml.apache.org/xalan-c", // root element namespace URI. "foo:bar", // root element name DOM_DocumentType()); // document type object (DTD). DOM_Element rootElem = doc.getDocumentElement(); rootElem.setAttributeNS(DOMString("http://www.w3.org/2000/xmlns/"), DOMString("xmlns:foo"), DOMString("http://xml.apache.org/xalan-c")); rootElem.setAttributeNS(DOMString("http://xml.apache.org/xalan-c"), DOMString("foo:attr"), ("value")); etc... If that doesn't work, then there may be a bug in Xalan. You might also want to investigate creating Xalan's internal source tree instead of building a DOM. It's much more efficient for transforming, and you can do it through SAX2 events. The disadvantages are that you must build the tree in document order, and you cannot modify it once you created it. Dave Holger Fl�rke <floerke@doctron To: [EMAIL PROTECTED] ic.de> cc: (bcc: David N Bertoni/CAM/Lotus) Subject: Creating DOM Level2 - Xerces-C 01/25/2002 02:17 AM Please respond to xerces-c-dev I use the double feature Xerces-C 1.6.0 and Xalan-C 1.3. When I construct a Xerces-C DOM and tell Xalan-C to transform it, I get an errror related to namespaces. The Xalan-C people mentioned I have to create a DOM Level2. MMh. How do I do this? I use "DOM_Document::createDocument()" to create a DOM_Document and add many Elements, Attributes with "createElementNS(...)" and "createAttributeNS(...)". Is there a special switch to turn on DOM Level 2? How can I test whether my DOM_Document is DOM Level2 or Level1? TIA HolgeR -- holger floerke d o c t r o n i c email [EMAIL PROTECTED] information publishing + retrieval phone +49 2222 9292 90 http://www.doctronic.de --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
