performance of importNode

A

Andy Fish

Hi,

I have server-based Java application that maintains a fairly large XML
structure as a DOM. In response to a user request I want to select various
nodes (including sub-nodes) and jam them together to be returned as a new
piece of XML. This is run through an XSLT transform to produce (typically)
an HTML page.

From what I can see, the obvious way to do it is to make a brand new XML
document for each user response and then use Document.importNode (with
deep=true). to copy all the selected nodes across into it. The nodes
themselves are not large (including sub-nodes) but there may be 100 or so of
them, so 100 calls to importNode for a single user request.

Does anyone have any feel for whether this is a really inefficient thing to
do? I haven't suffered any performance problems yet but the name of the
function 'import node' gives the impression that a lot of work is going on
behind the scenes. I realise I haven't been specific about performance
requirements but this is potentially an 'enterprise scalable' application so
I want to avoid doing anything really stupid.

Ideally I would like to be able to just string together pointers to the
selected nodes without having to copy anything, and then run the transform
on that, but I can't see a way of doing that without building a new XML
document.

Many thanks in advance for any advice

Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top