<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: examples code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 18 May 2008 14:42:18 GMT</pubDate>
    <description>DZone Snippets: examples code</description>
    <item>
      <title>Helpful XPath examples</title>
      <link>http://snippets.dzone.com/posts/show/5443</link>
      <description>A few XPath examples copied from &lt;a href="http://www.w3schools.com/XPath/xpath_syntax.asp"&gt;XPath Syntax&lt;/a&gt; [w3schools.com]&lt;br /&gt;&lt;br /&gt;Predicates&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/bookstore/book[1] 	# Selects the first book element that is the child of the bookstore element. &lt;br /&gt;                        # Note: IE5 and later has implemented that [0] should be the first node, &lt;br /&gt;                        # but according to the W3C standard it should have been [1]!!&lt;br /&gt;/bookstore/book[last()] 	# Selects the last book element that is the child of the bookstore element&lt;br /&gt;/bookstore/book[last()-1] 	# Selects the last but one book element that is the child of the bookstore element&lt;br /&gt;/bookstore/book[position()&lt;3] 	# Selects the first two book elements that are children of the bookstore element&lt;br /&gt;//title[@lang] 	# Selects all the title elements that have an attribute named lang&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Selecting Unknown Nodes&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/bookstore/* 	# Selects all the child nodes of the bookstore element&lt;br /&gt;//* 	# Selects all elements in the document&lt;br /&gt;//title[@*] 	# Selects all title elements which have any attribute&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Selecting Several Paths&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//book/title | //book/price  	# Selects all the title AND price elements of all book elements&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 29 Apr 2008 23:34:28 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5443</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
  </channel>
</rss>
