XML – What is XPath?

The XPath language is a tree representation of XML documents. It allows the user to navigate around the document’s tree, selecting nodes by various criteria.

Originally created to provide a common language and behavior model between XSLT and XPointer, XPATH is often used in other W3C standards

For the below XML.,

The XPATH to find the author for the book id:6260 is

/catalog/book[@id = ‘6260’]/author

The XPATH to find the price for the book id:6260 is

catalog/book[@id = ‘6260’]/price (or) catalog/book[1]/price

The book[1] denotes the first child of the book element which can be appear more than one.,

Leave a Comment

Your email address will not be published. Required fields are marked *