oXygen XML Editor

XPATH via Java

XML access from a Java environment

I'm far from sure how useful this will be, but I've wanted it for some time, so I'm guessing that others might too? The problem is, I have some data on disc, in XML that I want to access from a Java program (especially now that it's open sourced :-). I really want to use the XML as a lookup, so all I need is an xpath expression and the name of an XML file. Anyway, this is what I came up with. A class file, with a constructor, parameter the XML source file, and a single method used to retrieve a List of the results. The method is GetValue.resolveExpression("xpath expression"), where the parameter is the required (String) xpath value. I linked it with XSLT 2.0 (Saxon of course) rather than XSLT 1.0, since it may grow. Anyway, enjoy. Compile it with the two jar files from Saxon, where xx is the version; e.g. saxon8.jar and saxon8-xpath.jar, then call it using import resolve.GetValue("InputXMLFile") and then use the String result [] GetValue.resolveExpression("expression") method. Enjoy. Java source is GetValue.java.