Xpath presentation

1,303 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,303
On SlideShare
0
From Embeds
0
Number of Embeds
16
Actions
Shares
0
Downloads
58
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Xpath presentation

  1. 1. AN OVERVIEW ABOUT XPATH
  2. 2. XPATH INTRODUCTION
  3. 3. WHAT IS XPATH XPath is a syntax for defining parts of an XML document XPath uses path expressions to navigate in XML documents XPath contains a library of standard functions XPath is a major element in XSLT
  4. 4. PATH EXPRESSIONSXPath uses path expressions to select nodes or node-sets in an XMLdocument. 
  5. 5. XPath is Used in XSLT
  6. 6. XPath Standard Functionsnumber position()Return the position of the context node among the list of nodes thatare currently being evaluated.count()Return the number of nodes in the argument node-setEj:number count(node-set)number last()Return the index of the last node in the list that is currently being evaluated.
  7. 7. XPATH NODES
  8. 8. XPATH TERMINOLOGY
  9. 9. <bookstore>  <book>    <title lang="en">Harry Potter</title>    <author>J K. Rowling</author>    </book></bookstore>
  10. 10. RELATIONSHIP OF NODES <history> <year>2012</year> <month>9</month> Children and SiblingsParent <day>27</day> </history> Parent: Each element and attribute has one parent. Children: Element nodes may have zero, one or more children. Siblings: Nodes that have the same parent.
  11. 11. <wiki> <history> <year>2012</year> Ancestor <month>9</month> Descendants <day>27</day> </history> </wiki> Ancestors: A nodes parent, parents parent, etc. Descendants: A nodes children, childrens children, etc.
  12. 12. XPATH SYNTAX
  13. 13. Selecting NodesXPath uses path expressions to select nodes in an XML document
  14. 14. PredicatesPredicates are used to find a specific node or a node that contains aspecific value.
  15. 15. Selecting Unknown NodesXPath wildcards can be used to select unknown XML elements.
  16. 16. Selecting Several NodesBy using the | operator in an XPath expression you can select several paths.
  17. 17. XPATH AXES
  18. 18. XPath AxesAn axis defines a node-set relative to the current node.
  19. 19. LOCATION PATH EXPRESSIONA location path can be absolute or relative. An absolute location path starts with aslash ( / ) and a relative location path does not. In both cases the location path consistsof one or more steps, each separated by a slash: /step/step/... step/step/...
  20. 20. Each step is evaluated against the nodes in the current node-set.A step consists of:an axis (defines the tree-relationship between the selected nodes and thecurrent node)a node-test (identifies a node within an axis)zero or more predicates (to further refine the selected node-set) axisname:: nodetest [predicate]
  21. 21. EXAMPLES OF PATH EXPRESSION
  22. 22. XPATH OPERATORS
  23. 23. Below is a list of the operators that can be used in XPath expressions:
  24. 24. XPATH EXAMPLESCLICK ON IT

×