Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Friday, September 14, 2007

Using XPath for reading attribute and content of XML

I used this type of XPath functionality for creating a rotating image based on an XML file.

<-- First the XML -->
<image href="img1">1</image>
<image href="img2">2</image>

<-- Next the XPath for C# -->
<-- get all image hrefs (and other attributes) -->

<-- get image value at image position 1 -->

<-- get href attribute at images/image position 1 -->

No comments: