You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by "Gaur, Manish" <Mg...@rsasecurity.COM> on 2002/10/29 02:21:51 UTC

Using DOMDocument Vs DOM_Document with ParserLiaison

Hi All,
   If I understand correctly Xalan 1.4 uses Xerces 2.1 for DOM, right?? My
question is somewhat related to it, in Xalan 1.3 I could do the following,


XalanSourceTreeDOMSupport *domSupport = new XalanSourceTreeDOMSupport() ; ;
XalanSourceTreeParserLiaison *parserLiaison = new
XalanSourceTreeParserLiaison (*domSupport) ;
// create DOM_Document object
DOM_Document *pobjDOMDocument = ...; /*create or get the pointer*/

// create a XalanDocument from the given DOM_Document
XalanNode *theXalanNode = 
  (XalanNode *)(parserLiaison->createDocument(
                  *pobjDOMDocument, true, true)) ;


But, now if I am using Xerces 2.1 I "should(?)" be using DOMDocument and not
DOM_Document...so is there a way in which I can create a XalanDocument from
a 'DOMDocument'???

I haven't seen many new objects from Xerces 2.1 being use in Xalan 1.4. Any
reason or have I gotten in completely wrong?

Any help is greatly appreciated.

Thanks,
/Manish

Re: Using DOMDocument Vs DOM_Document with ParserLiaison

Posted by David N Bertoni/Cambridge/IBM <da...@us.ibm.com>.



"Gaur, Manish" <Mg...@rsasecurity.COM> wrote:
> Hi All,
>    If I understand correctly Xalan 1.4 uses Xerces 2.1 for DOM, right??

No.  Xalan supports using the Xerces DOM, but it doesn't need to use it.

> My question is somewhat related to it, in Xalan 1.3 I could do the
following,
>
>
> XalanSourceTreeDOMSupport *domSupport = new XalanSourceTreeDOMSupport() ;
;
> XalanSourceTreeParserLiaison *parserLiaison = new
> XalanSourceTreeParserLiaison (*domSupport) ;
> // create DOM_Document object
> DOM_Document *pobjDOMDocument = ...; /*create or get the pointer*/

This is wrong.  DOM_Document is a smart-pointer, and you shouldn't have a
pointer to one.

>
> // create a XalanDocument from the given DOM_Document
> XalanNode *theXalanNode =
>   (XalanNode *)(parserLiaison->createDocument(
>                   *pobjDOMDocument, true, true)) ;
>
>
> But, now if I am using Xerces 2.1 I "should(?)" be using DOMDocument and
not
> DOM_Document...so is there a way in which I can create a XalanDocument
from
> a 'DOMDocument'???

You can still use the old DOM_* interfaces.

> I haven't seen many new objects from Xerces 2.1 being use in Xalan 1.4.
Any
> reason or have I gotten in completely wrong?

The interim build has a new wrapper for the new Xerces DOM.  You can
download that and experiment with it, if you want.  However, you should
only use the Xerces DOM if you plan to manipulate the document between
parsing it and transforming it.  Otherwise, you're doing something
unnecessary, which is very inefficient.

Dave