Mega Code Archive

 
Categories / XML Tutorial / Xpath
 

Modeling XML Documents with Axis

<?xml version="1.0" encoding="UTF-8"?>  <Book>      <Chapter>Some content</Chapter>      <Appendix>Some appendix content.</Appendix>  </Book>  When giving street directions, you have four basic directions: north, south, east, and west.  In XPath, a direction is called an axis.  In XPath, there are 13 directions called Axes.      child axis      attribute axis      ancestor axis      ancestor-or-self axis      descendant axis      descendant-or-self axis      following axis      following-sibling axis      namespace axis (not used in XQuery, and deprecated in XPath 2.0)      parent axis      preceding axis      preceding-sibling axis      self axis  In XPath, you might write something like this: /Book/Chapter[@number=2]  A relative location path could be written as follows: Chapter[@number=2]