<-- First the XML -->
<images>
<image href="img1">1</image>
<image href="img2">2</image>
</images>
<-- Next the XPath for C# -->
<-- get all image hrefs (and other attributes) -->
images//image
<-- get image value at image position 1 -->
images//image[position()=1]
<-- get href attribute at images/image position 1 -->
images//image[position()=1][@href]
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.
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2007
(41)
-
▼
September
(13)
- Connecting to Kensoft.net SQL Server 2005 database
- Copying a MDF SQLExpress Database file to SQL Serv...
- Building an AJAX Slide Show in ASP.net
- Proper ViewState use and the coalescing operator
- GridView table headers and iterating over a GridVi...
- DataGridView cell contents and header contents
- HTML Table header accessibility standards
- C# switch statement for DropDownList to update Ima...
- Using XPath for reading attribute and content of XML
- Nested GridView with subtotals, totals, and counts
- Modifying the contents of a GridView after DataBin...
- Highlight search text functions using css tags and...
- C# to run stored procedure after parsing text
-
▼
September
(13)
No comments:
Post a Comment