473,651 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_dispatc h.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(c urXMLDoc)

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;ui d=sa;password=x xx;database=xxx x"
Dim sqlConn As SqlConnection = New SqlConnection(m yConnectString)
sqlConn.Open()
Dim sqlComm As SqlCommand = New SqlCommand(mySe lectQuery, sqlConn)
sqlComm.Command Timeout = 15
Dim reader As XmlTextReader = CType(sqlComm.E xecuteXmlReader (),
XmlTextReader)

' Instantiate an XPathDocument using the XmlTextReader.
' Dim doc As XPathDocument = New XPathDocument(r eader,
XmlSpace.Preser ve)

docNav = New XPathDocument(r eader, XmlSpace.Preser ve)
Please help...

Dec 1 '05 #1
0 1049

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

Similar topics

5
5637
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: XmlReader instance from another module (beyond my control)
2
3713
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 public inside the class)
2
5873
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 SerializeXMLSelectedApplication() { System.IO.MemoryStream stream = new MemoryStream(); try
8
2449
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 single XPathDocument which is then transformed throughout the web site with different XslTransformations. I realize that the Xpathdocument will accept a XmlReader as an object but I have 5 of them so how to 'best' combine. The resulting...
2
11930
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 node I get back the "values" of the child nodes but no formatted xml which I need for transformations later in the sequence. Is there a way to pull pure xml from the xpathdocument?
1
5490
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 = new XPathDocument(filename, System.Xml.XmlSpace.None);
2
3456
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 reflected in the XPathDocument? Do I have to reload the XPathDocument? If so, would I need to dispose of the old XPathDocument and it's associated XPathNavigator somehow? Can I even change a node value in the XPathDocument? E.g. if I want to change...
2
4445
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 node As XmlNode = proxy.RetrieveArchivedTrips(strDate, endDate) Dim doc As XmlDocument = node.OwnerDocument doc.AppendChild(node)
5
6280
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 than XmlDocument. I've run the tests several times and have tried to eliminate extraneous variables like disk access but every time, XPathDocument comes up slower by a few percent. I'd expected it to be faster since it's a read-only...
0
8697
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8579
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7297
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4283
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2699
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1909
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1587
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.