You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by David N Bertoni/CAM/Lotus <da...@us.ibm.com> on 2002/02/01 04:21:03 UTC

Re: Creating DOM Level2 - Xerces-C

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:      xerces-c-dev@xml.apache.org                                                   
                      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 floerke@doctronic.de         information publishing + retrieval
phone +49 2222 9292 90             http://www.doctronic.de


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org







---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org