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 Indrajit Bhattacharya <in...@rediffmail.com> on 2007/02/13 14:36:08 UTC

Xerces DOM with Xalan

Hi,

I have some beginner level questions. I would be grateful for your responses.

We store all our data as xerces DOM in our application. Is there any problem using these xercesc::DOMNode* data with Xalan for XPath and XSLT ?

Does Xalan create a separate data structure out of the xerces DOM for doing works like XPath expression evaluation ? 

How to use xercesc::DOMNode* with Xalan for evaluating XPath expressions ?

Are there any performance penalty with using xerces DOM with Xalan library ? Any memory usage concerns ?

Regards,
Indrajit

Re: Re: Xerces DOM with Xalan

Posted by Will Sappington <ws...@ndma.us>.
>Indrajit Bhattacharya wrote
>Hi Dave,
>
>Thanks a lot for your reply.
>
>>>We store all our data as xerces DOM in our application. Is there any 
>>>problem using these xercesc::DOMNode* data with Xalan for XPath and 
>>>XSLT ?
>>>
>>
>>That depends on what you mean by "problem..."
>
>Here my intension is: given a xercesc::DOMNode* pointer, we need to
perform 
>XPath expression evaluation, the expression being taken from user of
the 
>application. Do you see any issue in this use model ?
>
>Thanka again,
>-Indrajit

You might want to try reading the FAQ, it has a topic that deals
specifically with Xerces DOM's and Xalan.  Here is what it says (the
HTML documentation has embedded links to related topics):

Should I be using the Xerces DOM or Xalan DOM?	

The Xalan DOM implementation is highly optimised for transformations.
However, whilst you can build documents in the Xalan DOM, subsequent
modification will not work. The Xalan DOM is designed to be either an
input or an output from a transformation, not as a general DOM
implementation.

So in cases where you want to simply transform documents using Xalan,
using the internal DOM implementation is the best approach.

In cases where you want to modify the DOM document on the fly, you
should use the Xerces DOM as the base document. You can wrap the Xerces
DOM in a wrapper (see passing in a Xerces DOM) to then use as an input
to a Xalan transformation. Alternatively you can output the result of a
transformation to a Xerces DOM document (see working with DOM input and
output). In either case, the Xerces document can be freely modified.
However, after you modify the document, you need to re-build the wrapper
so that any changes are replicated in the Xalan wrappers.

If that doesn't help you, perhaps a search through the archives may also
yield some useful information while you await our responses.

I don't know whether XPath evaluation will work on a Xerces DOM or not.
I'm implementing an XPath solution but I'm using the Xalan DOM.  

-will

Re: Xerces DOM with Xalan

Posted by David Bertoni <db...@apache.org>.
Indrajit Bhattacharya wrote:
> Hi,
> 
> I have some beginner level questions. I would be grateful for your 
> responses.
> 
> We store all our data as xerces DOM in our application. Is there any 
> problem using these xercesc::DOMNode* data with Xalan for XPath and XSLT ?
> 

That depends on what you mean by "problem..."

> Does Xalan create a separate data structure out of the xerces DOM for 
> doing works like XPath expression evaluation ?

Yes

> 
> How to use xercesc::DOMNode* with Xalan for evaluating XPath expressions ?

You can search the archives of this list for more information.
> 
> Are there any performance penalty with using xerces DOM with Xalan 
> library ? Any memory usage concerns ?

Yes.  There is a fairly significant memory overhead, and a potentially high 
overhead for ordering nodes within the document.  How high that is depends 
on the kinds of XPath expressions you use.

Dave