ctangent
asked on
Using Xalan-J with JDOM?
JDOM allows you to use XPath but the default XPath processor is Jaxen. How would I go about using Xalan-J from Apache instead?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
My suggestion reffers only to the XPath implementation. The results should be the SAME ON ANY IMPLEMENTATION. If this is not the case, then it means that particular implementation does not respect W3C. My suggestion still stands (you should select the XPath implementation using A JVM system property).
Your code snippet seems correct.
Your code snippet seems correct.
ASKER
enachemc, thank you very much for your help!
ASKER
In the class org.jdom.xpath.XPath, there is a function:
static void setXPathClass(java.lang.Cl
Sets the concrete XPath subclass to use when allocating XPath instances.
from: http://www.jdom.org/docs/apidocs/org/jdom/xpath/XPath.html
I want to clarify, what I would like to do is use xpath calls with JDOM, so that:
for XML doc:
<appxml>
<function name="test">1</function>
<function name="foo">2</function>
</appxml>
Instead of doing:
List funcs = root.getChildren("function
Iterator i = funcs.iterator();
Element fooFunc;
while(i.hasNext()){
Element e = (Element) i.next();
if(e.getAttributeValue("na
fooFunc = e;
}
I can do:
Element fooFunc = (Element) XPath.selectSingleNode(thi
From this clarification, does your suggestion still stand? Should I ignore the JDOM XPath function setXPathClass(java.lang.Cl
JDOM defaults to using Jaxen as it's XPath parser, which is not good if I want to use Xalan-J