SCJP home
  SCWD Home
  XML Tutorial
  Java jobs
  Java News
  About Java Prepare
   Books
  Certification Books
  SCEA Books
  SCWD Books
  Online Books
   Tutorial Topics
  Basic XML
  DTD
  Schema
  Entities
  Name Spaces
  Xlink and Xpath
  DOM
  SAX
  Xpath
  XSL-FO
  xslt
   Partners
xmlspy
 
SCWD home | SCJP home | XML books

XPath

  1. XPath allows selected or filtered information from within the source XML data or document to be exchanged or displayed
  2. XPath is designed to enable addressing of or navigation to chosen parts of an XML document
  3. XPath is used to navigate a hierarchical structure
  4. Context node: starting point
    Axis - specific direction that is selected
    Location steps - steps taken to reach the destination
  5. 7 nodes and 13 axes
  6. A location path consists of one or more location steps
  7. Node test: specifies the type of node selected and its expanded name
  8. Location step has 3 parts: axis, node test, zero or more predicates
  9. XPath has both abbreviated and unabbreviated syntax
  10. Unabbreviated syntax - axis::nodetest [predicate]
  11. The representation of the abstract structure of the XML document is called a data model
  12. 7 nodes are:
    1. Root node
    2. Element node
    3. Attribute node
    4. Text node
    5. Comment node
    6. Namespace node
    7. ProcessingInstruction node
  13. An element node is the parent of an attribute node but an attribute node is not the child of its parent element node.
  14. There is a way to determine the string value for a node:
    1. Root node: the string value is the concatenation of the string value of the text node descendants of the root node in document order.
    2. Element node: the string value is the concatenation of the string value of the text node children of the element node in document order
  15. A comment node does not have any expanded name
  16. A location path is a special form of an XPath expression that returns only a nodeset.
  17. Context in XPath has 5 parts:
    1. Context node
    2. A pair of non-zero positive integers (context position, context size)
    3. A set of variable bindings
    4. A function library
    5. The set of namespace declarations
  18. 13 axes are:
    1. Child
    2. Parent
    3. Ancestor
    4. Descendant
    5. Ancestor-or-self
    6. Descendant-or-self
    7. Following-sibling
    8. Preceding-sibling
    9. Following
    10. Preceding
    11. Attribute
    12. Namespace
    13. Self
  19. Important points on axes:
    1. Child node - it never returns an attribute or a namespace node
    2. Parent - if the context node is the root node, parent is null
    3. Descendant - all children and childrens children and so on are returned except attribute or namespace nodes
    4. Following-sibling - If the context node is attribute or namespace node, following-sibling is empty
    5. Preceding-sibling - If the context node is attribute or namespace node, preceding-sibling is empty
    6. Following - all nodes that are after the context node are returned except any descendants and excluding attribute or namespace nodes
    7. Following - all nodes that are before the context node are returned except any ancestors and excluding attribute or namespace nodes
    8. Attribute - if the context node is not element, null is returned
    9. Namespace - if the context node is not element, null is returned
    10. Self - contains the context node
  20. XPath expression returns any of these: Nodeset, Boolean, String or Number
  21. XPath expression returns any of these: Nodeset, Boolean, String or Number
  22. Nodeset functions:
    Count(), Id(), Name(), Local-name(), Last(), Namespace-uri(), Position()
  23. Boolean functions:
    True(), False(), Not(), Lang(), Boolean()
  24. Number functions:
    Ceiling(), Floor(), Round(), Number(), Sum()
  25. String functions: Concat(), Contains(), Normalize-space(), String(), Substring(), String-length(), Starts-with(), Substring-before(), Substring-after(), Translate()
  26. Absolute location paths are special case of relative location paths where the context node is the root node of the XML document.

46% off Bestsellers at BAMM.COM
SCWD home | SCJP home | XML books