AspNet.sk     Diskusné fóra     Vitajte v QuickStarts     ASP.NET     Silverlight     Ako môžem...? (en)     Class prehliadač Príklady chcem v ...   
Menu
Skip Navigation Links.

How Do I...? Common Tasks QuickStart Tutorial

How Do I...Process XML Data Using XPath?

This sample illustrates how to process XML data using the XPathNavigator class. An XPathDocument object is used to load the XML document, and to return an XPathNavigator object. The XPathNavigator object is then used to create a compiled XPath expression in an XPathExpression object. The selection methods of the XPathNavigator object then select XML data using the compiled XPath expression. Finally, the navigation methods of the XPathNavigator and XmlDocument classes are used to navigate the XML data in the XML document.

VB XPathWithXPathDoc.exe
View Source

[This sample can be found at H:\Home\WU_000036_efe47225c86ca62f325a01d8519bc002\Webs\aspnet.sk\quickstarts\QuickStartv20\howto\samples\Xml\BinaryDataInXml\
To build this sample, open the SDK command prompt and navigate to the above path. Build the sample using the build tool msbuild passing the solution file as the first parameter: msbuild mySample.sln. The compiled executable will be found in the sub directory \bin directory.]

The following code creates the XPathDocument object and loads the XML document.


Dim xPathDocument As New XPathDocument(document)
VB

The following code returns an XPathNavigator object from the XPathDocument object.


Dim xPathNavigator As XPathNavigator = xPathDocument.CreateNavigator()
VB

The following code creates a compiled XPath expression in an XPathExpression object using the XPathNavigator object.


xPathExpr = xPathNavigator.Compile(selectExpr)
VB

The following code selects XML data using the compiled XPath expression.


Dim xPathNodeIterator As XPathNodeIterator = xPathNavigator.Select(xPathExpr)
VB



Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2005 Microsoft Corporation. All rights reserved.


Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright © 2005 Microsoft Corporation. All rights reserved.
Preklad do slovenského jazyka - Copyright © 2005 - 2007 www.aspnet.sk, www.qsh.sk
Pošlite komentár k tejto stránke
Copyright © 2002 - 2008 Chastia, spol. s r. o., Igor Stanek, Designed by Lacino
Portál je hostovaný na serveroch firmy Quantasoft - www.qsh.sk.