XMLDataSource control of ASP.Net has a property XPath that takes the value as XPath query to read the XML Nodes list under that specified XML path. XPath query works like SQL Select query that can select the XML nodes or a single XML node based on the syntax of XPath expression passed. For XMLDatasource control you can set the path of XML data file into its DataFile property and XPath value can be set according to the elements of the specified XML file.
<movieList>
<movie id="1">
<title>Bad Boys</title>
</movie>
<movie id="2">
<title>Chronicles of Narnia</title>
</movie> <movie id="3">
<title>The Love Guru</title>
</movieList>
In the above XML file code movieList is a root node and movie is child node element. movie element contains id attribute and title child node. movie node is repeated again and again to store the hierarchical data in XML file with movie topics. You can add more item nodes inside the movie element to store more information about movie like we have stored its title.
XPath query expression accepts the following path expressions to select the nodes from the XML document:
Be the first to rate this post
Tags: asp.net, xml, asp.net xmldocument, asp.net xml xpath, asp.net xmldatasource control, asp.net xml namespace, asp.net xmldocument selectnodes, asp.net xmldocument selectsinglenode, asp.net xpath expressions, asp.net xpath syntax, asp.net xml elements, asp.net xml attributes, asp.net xml nodes, asp.net xmldatasource datafile, asp.net xmldatasource xpath
8/23/2008 8:40:50 PM