Site Map       
Home
Web Services
XML in .NET
XML Schema
XSLT and XPath
XML Serialization
Database and XML
XML Query
ASP.NET
Contact Info

.NET Notes

Sample Code for this Program can be found at the bottom right hand side of this page.

Please visit our Partner....

 

XPath Query Expression Tool

Enter an XPath Query Expression and click the Test XPath Button. You can use the default document in the XML Document TextBox or replace the default document with one of your own.


Xpath Query Expression:

                                                                                           

XML Document:

'XPath Query Expression Tool Sample Code

        Try

            XpDoc = New XPathDocument(XmlDocument)
            XpNav = XpDoc.CreateNavigator
            XpExp = XpNav.Compile(TextBox1.Text)
            XpNodeIterate = XpNav.Select(XpExp)

            If XpNodeIterate.Count = 0 Then
                lblResults.ForeColor = Yellow
                lblResults.Text = "No matching nodes were found"
            Else
                Do While XpNodeIterate.MoveNext
                    lblResults.Text = lblResults.Text & XpNodeIterate.Current.Value
                Loop
            End If

        Catch XmlException As System.Xml.XmlException
            lblResults.ForeColor = Red
            lblResults.Text = "XML Error: " & XmlException.ToString

        Catch XpException As System.Xml.XPath.XPathException
            lblResults.ForeColor = Red
            lblResults.Text = "XPath Error: " & XpException.ToString

        End Try

XMLME.COM is a Registered ® Service Mark of Seanco Technology.  Copyright © 2008 Seanco Technology, Inc.  All rights reserved.