BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


SQL XML
What is the usage of the XmlDataDocument?


 
 

<< SEOSystem.XML >>


By Sonu Kapoor
First Posted 02/20/2005
Times viewed 173

How to display the first three nodes of a XML file with XmlDocument?


Summary How to display the first three nodes of a XML file with XmlDocument?

Some websites only shows the latest 3 articles or news on their website. Mainly they are using a SQL Server as a backend. However the same task can be accomplished with XML. In this small example you will learn how you can retrieve only the top 3 XML items. The key is to use again the SelectNodes function, with the position function. position is a XPath function which returns the position of the current node. Here is the xml file I am using for that example.

Output:

description of the 1st news description of the 2nd news description of the 3rd news

As you can see the XML file contains 5 items, however only 3 are displayed.

Additional information

Further additional information


Rate this article on a scale of 1 to 10 (0 votes, average 0)

Your vote :  

<< SEOSystem.XML >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML