473,324 Members | 2,473 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,324 software developers and data experts.

XPathDocument

I need a way to allow a variable to equal an xml document. When using
xpathdocument the parameter is asking for a filename. Since I plan on doing
a lot of search in the xml document I would like to supply a variable instead
of the xml doc.

This is the code I use:
dim docNav As XPathDocument
docNav = New XPathDocument("c:\adsp_dispatch.xml")

I would like to use something like:
dim docNav As XPathDocument
dim curXMLDoc = [a SQL statenent that gets the XML message/document from my
SQL server]
docNav = New XPathDocument(curXMLDoc)

I found the following code, but I cannot get it to work:

Dim mySelectQuery As String = "select msg as val from tblMessage
where id=1011 FOR XML AUTO, XMLDATA, " & _
"ELEMENTS, BINARY BASE64"

Dim myConnectString As String =
"server=xxxx;uid=sa;password=xxx;database=xxxx "
Dim sqlConn As SqlConnection = New SqlConnection(myConnectString)
sqlConn.Open()
Dim sqlComm As SqlCommand = New SqlCommand(mySelectQuery, sqlConn)
sqlComm.CommandTimeout = 15
Dim reader As XmlTextReader = CType(sqlComm.ExecuteXmlReader(),
XmlTextReader)

' Instantiate an XPathDocument using the XmlTextReader.
' Dim doc As XPathDocument = New XPathDocument(reader,
XmlSpace.Preserve)

docNav = New XPathDocument(reader, XmlSpace.Preserve)
Please help...

Dec 1 '05 #1
0 1031

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

Similar topics

5
by: xmlguy | last post by:
I believe this should be pretty elementary, but for some reason I cannot seem to think of how to write the an XML file from an incoming XML file. Basically this is what I do: Input: ...
2
by: xmlguy | last post by:
Cant seem to solve this problem I need to be able to re-use XmlReader and XPathDocument for an XSLT Transform. Basically I have defined following interfaces: Class Render (Common and...
2
by: D | last post by:
Hi, I am trying to instantiate an instance of XPathDocument after serializing XML into a memory stream. Here is my method that uses XmlSerializer public MemoryStream...
8
by: Keith Chadwick | last post by:
My problem is this. I have to create several xmlReader objects each retrieving 'for xml' formatted sql server data. I then need to peice them together into a single document and place them into a...
2
by: Robert Strickland | last post by:
I load an xml stream into a xpathdocument type, compile a xpath expression and select to specific node. I find the node and wish to return the innerxml of that node. When I use value of the current...
1
by: CV | last post by:
I am trying to extract specific fields out of XML documents using XPathDocument & Xpath. The basic code outline is as follows: try { ...//Load file as XpathDocument .. XPathDocument xp...
2
by: steve bull | last post by:
I have an XPathDocument which contains a list of color definitions. If I want to add a new color definition to, or delete an existing one from, the source xml file how can I force this to be...
2
by: Tony Girgenti | last post by:
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...
5
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... I've been trying to improve the performance of our xml handling, so I've been doing some timing tests lately and ran across something I thought odd - XPathDocument seems slightly slower...
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...
1
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...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.