Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Parsing an XML Document with XPath

The getter methods in the org.w3c.dom package API are commonly used to parse an XML document. But J2SE 5.0 also provides the javax.xml.xpath package to parse an XML document with the XML Path Language (XPath) .

Tutorial Details:

The JDOM org.jdom.xpath.XPath class also has methods to select XML document node(s) with an XPath expression, which consists of a location path of an XML document node or a list of nodes.

Parsing an XML document with an XPath expression is more efficient than the getter methods, because with XPath expressions, an Element node may be selected without iterating over a node list. Node lists retrieved with the getter methods have to be iterated over to retrieve the value of element nodes. For example, the second article node in the journal node in the example XML document in this tutorial (listed in the Overview section below) may be retrieved with the XPath expression:


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Parsing an XML Document with XPath

View Tutorial:
Parsing an XML Document with XPath

Related Tutorials:

Programming XML in Java, Part 1 - JavaWorld March 2000
Programming XML in Java, Part 1 - JavaWorld March 2000
 
Easy Java/XML integration with JDOM, Part 1 - JavaWorld May 2000
Easy Java/XML integration with JDOM, Part 1 - JavaWorld May 2000
 
XML document processing in Java using XPath and XSLT - JavaWorld September 2000
XML document processing in Java using XPath and XSLT - JavaWorld September 2000
 
Mapping XML to Java, Part 1 - JavaWorld August 2000
Mapping XML to Java, Part 1 - JavaWorld August 2000
 
Validation with Java and XML Schema, Part 2 - JavaWorld October 2000
Validation with Java and XML Schema, Part 2 - JavaWorld October 2000
 
Combine the power of XPath and JSP tag libraries - JavaWorld January 2001
Combine the power of XPath and JSP tag libraries - JavaWorld January 2001
 
XML APIs for databases - JavaWorld January 2000
XML APIs for databases - JavaWorld January 2000
 
Use XML data binding to do your laundry
Use XML data binding to do your laundry
 
XML documents on the run, Part 1
XML documents on the run, Part 1
 
XML glossary
XML glossary
 
AurigaDoclet: Javadoc doclet for generating javadoc in pdf, postscript, etc
What Is AurigaDoclet? AurigaDoclet is a Javadoc doclet which can generate Java API document in fo, pdf, postscript, pcl, and svg format. AurigaDoclet accepts command line options which can be used to further customize the generated output.
 
FastParser 1.6.3
FastParser 1.6.9.1 XML Edition FastParser is a Java Xml parser High performance XML parser (benchmarks* : up to +100% faster compared to Xerces and JDK1.4 integrated parser) SAX Level 1 and 2 compliant DOM support JAXP compatibility Names
 
Eclipse - XML / XSLT Plugin
Eclipse - XML / XSLT Plugin A plugin for the eclipse IDE adding XML / XSLT editing facilities
 
JXMLPad 2.3
JXMLPad 2.3 JXMLPad is a pure Swing java component/framework for editing XML/XHTML document.
 
Getting Groovy with XML
XML sucks. Oh, wait, XML rocks. Well, it actually does a lot of both. It rocks because of all of the editors, validators, and tools written for it. XML has all but replaced any notion of a new custom text-based data language. But it also sucks because it\
 
XML Document Validation with an XML Schema
This tutorial explains the procedure of validating an XML document with an XML schema.
 
JXMLPad 3.1 FC
JXMLPad is a pure Swing java component/framework for editing XML/XHTML document.
 
This tutorial shows how to Combine the power of XPath and JSP tag libraries
In this article, we'll examine the XPath custom tag library for JSPs and see a tag collection that provides simple control constructs and a uniform attribute value substitution facility, all of which combine to reduce complexity and improve functionality.
 
Generating an XML Document with JAXB
In this tutorial, JAXB is used to generate Java classes from an XML Schema. An example XML document shall be created from the Java classes.
 
Parsing an XML Document with XPath
The getter methods in the org.w3c.dom package API are commonly used to parse an XML document. But J2SE 5.0 also provides the javax.xml.xpath package to parse an XML document with the XML Path Language (XPath) .
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.