Checking XPath Expressions

Checking XPath Expressions

The Xalan package has a handy example program, ApplyXPath.java, that enables you to apply an XPath expression to a document and see what the results would be, which is great for testing. To run this example, you need to compile ApplyXPath.java into ApplyXPath.class using the java.exe tool that comes with Java.

As an example, Ill apply the XPath expression PLANET/ NAME to planets.xml using ApplyXPath.class. Heres the result, displaying all <NAME> elements that are children of <PLANET> elements (the <output> tags are added by ApplyXPath):

 %java ApplyXPath planets.xml PLANET/NAME  <output>  <NAME>Mercury</NAME><NAME>Venus</NAME><NAME>Earth</NAME>  </output> 


Inside XSLT
Inside Xslt
ISBN: B0031W8M4K
EAN: N/A
Year: 2005
Pages: 196

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net