cancel
Showing results for 
Search instead for 
Did you mean: 

Slow XPath evaluations in AS Java NW 7.1X

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Gurus

The slowest operations in our Java application running on NW 7.1X are XPath evaluations. We are using Java XPath processing API from JRE 1.5. Internally they are constantly performing search/initialization for Apache XPath processing factory and it takes much time. I'm talking about javax.xml.xpath.* API.

Do you know how to speed up the XPath evaluations? Is this the right forum for such questions?

Thanks and Regards, Sergei

Accepted Solutions (1)

Accepted Solutions (1)

siarhei_pisarenka3
Active Contributor
0 Kudos

Actually I tried the following approach...

The most time consuming task was a creation of instance of DTMManager for each XPath evaluation procedure. Internally the operation performs a search for suitable class-implementation of DTMManager in the following order:

1. query the system property using System.getProperty

2. read $java.home/lib/propertiesFilename file

3. read META-INF/services/factoryId file

Step 3 is the most time consuming task. Step 1 is very fast, but there is no any JVM system property set with reference to DTMManager class. This was a goal how I improved the performance here: I tried to setup JVM system property before any XPath evaluation:

final String DTM_MANAGER_PROP_NAME = "com.sun.org.apache.xml.internal.dtm.DTMManager";

boolean setDTMManager = (System.getProperty(DTM_MANAGER_PROP_NAME) == null)
if (setDTMManager) {
      System.setProperty(DTM_MANAGER_PROP_NAME, "com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault");
}
try {
      return xPathProcessor.evaluate(xPath, node, returnType);
} finally {
      if (setDTMManager) {
            System.clearProperty(DTM_MANAGER_PROP_NAME);
      }
}

What do you think about the solution? Is it acceptable on SAP Netweaver Java 7.1X?

Thanks and Regards, Sergei

Answers (2)

Answers (2)

siarhei_pisarenka3
Active Contributor
0 Kudos

See also my blog post with more details about this issue -

g_srivastava
Active Contributor
0 Kudos

Hi Siarhei,

I checked the thing and came out across TDOM it says TCIDom speeds up the process.Please check TDOm site using search engine.Hope your query resolves soon.

Have a best day ahead.