Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old August 17th, 2006, 03:25 PM
Tony Girgenti
Guest
 
Posts: n/a
Default System.XML.XPath XPathDocument load question

Hello.

I'm developing a web comsuming client using VS.NET 2003(VB), .NET
Framework 1.1.4322, ASP.NET 1.1.4322, WSE2.0 on a WinXP Pro Sp2 computer.

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" ?

I can create a file from doc by using "file.WriteLine(doc.OuterXml)" and use
that file in the above statement, but is there a way to do it directly from
"doc" ?

Any help would be gratefully appreciated.

Thanks,
Tony


  #2  
Old August 17th, 2006, 03:35 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: System.XML.XPath XPathDocument load question



Tony Girgenti wrote:

Quote:
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/
  #3  
Old August 17th, 2006, 04:45 PM
Tony Girgenti
Guest
 
Posts: n/a
Default 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@yahoo.dewrote in message
news:uUMXysgwGHA.724@TK2MSFTNGP04.phx.gbl...
Quote:
>
>
Tony Girgenti wrote:
>
>
Quote:
>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/

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.