Re: System.XML.XPath XPathDocument load question



Hello Martin.

Thanks for the explanation. So i can navigate thru the document using the
xmldocument method.

That helps tremendously.

Thanks,
Tony

"Martin Honnen" <mahotrash@xxxxxxxx> wrote in message
news:uUMXysgwGHA.724@xxxxxxxxxxxxxxxxxxxxxxx


Tony Girgenti wrote:


I'm getting an XML document this way:
Dim node As XmlNode = proxy.RetrieveArchivedTrips(strDate, endDate)
Dim doc As XmlDocument = node.OwnerDocument
doc.AppendChild(node)

At this point "doc" contains the XML document that i am using. However,
i'm reading Beginning VB.NET XML. In all of the examples to use
XPathDocument, it always refers to a file on disk such as:
Dim xpDoc As XPathDocument = New XPathDocument("..\\CaseStudy.xml")

In the above statement, how do i get my "doc" to be used in place of
"..\\CaseStudy.xml" ?

XmlDocument and XPathDocument are two different classes but both implement
IXPathNavigable.
So usually all you do with xpDoc is e.g.
Dim navigator As XPathNavigator = xpDoc.CreateNavigator();
where you could simply do
Dim navigator As XPathNavigator = doc.CreateNavigator();
to get an XPathNavigator over your XmlDocument instance. The use of that
navigator is the same then, whether you created it from an XPathDocument
or XmlDocument instance.
Does that help? Or why exactly do you want/need to have an XPathDocument
when you already have an XmlDocument?


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


.



Relevant Pages

  • Re: System.XML.XPath XPathDocument load question
    ... Dim node As XmlNode = proxy.RetrieveArchivedTrips ... At this point "doc" contains the XML document that i am using. ... In all of the examples to use XPathDocument, it always refers to a file on disk such as: ... XmlDocument and XPathDocument are two different classes but both implement IXPathNavigable. ...
    (microsoft.public.dotnet.xml)
  • Re: OuterXml from XPathNavitor in .NET 1.1
    ... Dim xmlDocument As XPathDocument = New XPathDocument ... I see in the documentation that I can cast the navigator to IHasXmlNode and then get an XmlNode from that cast. ... But the documentation indicates that this is only valid for navigators created from XmlDocument not XPathDocument. ... Dim navigator As XPathNavigator = xml_Document.CreateNavigator ...
    (microsoft.public.dotnet.xml)
  • Re: OuterXml from XPathNavitor in .NET 1.1
    ... In interest of simplicity I agree that I would like to drop XPathNavigator ... Dim nsMgr As New XmlNamespaceManager ... Can make XmlDocument select the nodes taking in consideration of the ... Dim navigator As XPathNavigator = xmlDocument.CreateNavigator ...
    (microsoft.public.dotnet.xml)
  • Re: Wert in einer XML-Datei ändern
    ... Dim document As XPathDocument = New XPathDocument ... XPathDocument eignet sich nur fuer den Lesezugriff, ... Dim XmlDoc As XmlDocument = New XmlDocument ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: XML-String aus XPathNavigator erhalten?
    ... So der Navigator ueber einem XmlDocument erzeugt wurde, ... XPathDocument, um den Overhead von XmlDocument zu vermeiden. ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)