Saturday, June 2, 2012

What is XPATH?


  • XPath is used to navigate through elements and attributes in an XML document.
  • XPath can locate any type of information in an XML document with one line of code.
  • These one liners are referred to as "expressions," and every piece of XPath that you write will be an expression.
  • Xpath contains library of standard function.
  • Following example demonstrate the xpath expression.

inventory.xml
if we wanted to know the amount of chips from left side xml , the XPath expression would be:           

inventory/snack/chips/amount 

If we wanted to select the price of pop, we would have to make an even longer path of elements to reach our final destination.

inventory/drink/pop/price