Hello,

Here is the performance issue I encounter using CachedXPathAPI to handle a
DOM XML document.
The structure of the document i have to work with is approximatively the
following :

<RPT>
   <DTL>
      <FLD id="x">xxx</FLD>
      <FLD id="y">xxx</FLD>
      <!-- ~25 instances -->
      <FLD id="z">xxx</FLD>
   </DTL>
   <DTL>
      <FLD id="x">xxx</FLD>
      <FLD id="y">xxx</FLD>
      <!-- ... -->
      <FLD id="z">xxx</FLD>
   </DTL>

   <!-- ~3500 instances -->
</RPT>

For a size of the whole document ~3.5MB

The code is the following :

1- Select all the DTL nodes using selectNodeIterator
2- Then for each DTL "in" the iterator, select each FLD using successive
selectSingleNode's 
Eg : 
CachedXPathAPI.selectSingleNode( elemDTL, "./[EMAIL PROTECTED]'x']" );
CachedXPathAPI.selectSingleNode( elemDTL, "./[EMAIL PROTECTED]'y']" );
...

The problem stands in the fact that the further you go into the XML
document, the longer it takes to perform that operation. It takes about 10ms
to handle a DTL element located at the beginning of the document, and about
750ms to handle a DTL element located at the end of the document.

Using a profiler I noticed that the problem seems to come from the method
XPathContext.getDTMHandleFromNode (and more precisely from one its
descendants DOM2DTM.getHandleFromNode) which apparently try to map the DOM
objects (Node, Element) onto a handle of Xalan internal model (DTM ?) and
which takes more and more time.

- It is because of the mapping dom => dtm handles implemented using a
sequential structure (Vector) ?
- Any idea on parameters which could improve this performances or on way to
re-write this code (I can only do minor changes for the moment) ?


Regards
--
S�bastien FOUCAULT

HR Access Solutions 
HR Design Client Development Team
Phone: (33) 1 70 38 33 09     Tie-line : 3309     
mailto:[EMAIL PROTECTED]

Reply via email to