473,320 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
Aug 17 '06 #1
2 4433


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/
Aug 17 '06 #2
Hello Martin.

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

That helps tremendously.

Thanks,
Tony

"Martin Honnen" <ma*******@yahoo.dewrote in message
news:uU*************@TK2MSFTNGP04.phx.gbl...
>

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/

Aug 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: mike p. | last post by:
I have a docbook xml file, and am using standard docbook 1.61.3 xsl stylesheets to do xhtml transform. Transform works fine when using MSXML. When I try to do the following using asp.net 1.1: ...
9
by: JJ | last post by:
Hi All, I noticed that XmlNode and XpathNavigator are quite similiar. XmlNode seems to navigate over an XML Doc and so does XPathNav so when do I use XPathNavigator instead of XmlNode? ...
6
by: Stefan Lischke | last post by:
Hi there, I'm still implementing the XML pub/sub System i told in my last mail. But i think i have to reeinvent the wheel when using Microsoft .Net Where can i get the Source Code of...
2
by: JerryShea | last post by:
My program runs out of memory when I do this: string filename = @"large.xml"; XPathDocument doc = new XPathDocument(filename); XPathNavigator nav = doc.CreateNavigator(); XPathNodeIterator...
12
by: David Thielen | last post by:
Hi; I have an element: <space> </space> When I call SelectSingleNode() on it, the InnerXml is a 0 length String, not a String containing 1 space. Any ideas?
6
by: Chua Wen Ching | last post by:
Hi there, I had this xml file with me (not yet consider implementing xml namespaces yet). <?xml version='1.0'?> <Object> <Windows> <EID>1</EID> <EDesc>Error 1</EDesc> </Windows>
5
by: Paw Pedersen | last post by:
When you are "working" on a specific node from a XmlDocument instance, is it possible to get the full xpath to this node? Regards Paw
8
by: Joe Pannone | last post by:
Does anyone have an example on using an XPath statement (in VB.NET) where the source XML document is NOT a file, but a 'text' value from SQL Server?
2
by: Lonewolf | last post by:
Hi all, please pardon me if this question is too trivial. I have an XML file which stores data in base64. The schema is something like this, <Remokon> <Brand Name="SONY"> <Model Name="Type 1",...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.