|
-
Dec 8th, 2008, 03:51 PM
#1
Thread Starter
Member
XPath and XML
I have an ASP.NET(vb) web application that currently uses xmlWriter(System.Xml) to create an XML document from a database query and write it to a file.
Now, I need to change this web application to use XPATH to grab data from other XML documents as well as database queries to create an XML document.
After reading a bit about XPATH, I am wondering if this is even possible.
I found this bit of info on .NET and XPath on another site:
XPathDocument: A high performance, read-only cache for processing XML documents and streams. XPathDocument uses the document object model (DOM)-based parsing model (loads the source XML into an in-memory tree structure) but does not implement the interfaces required to insert, to modify, or to delete nodes in an Extensible Markup Language (XML) document or stream.
Is XPathDocument what I need? From the description, it says it's read only. But I need to be able to use XPath to create an XML document.
Is there anything I am missing?
Thanks!
-
Dec 9th, 2008, 02:53 AM
#2
Re: XPath and XML
XPath is something used to query an existing structure of XML, it has nothing to do with creation according to the W3C standards. It's simply a way of saying to an implementor, "I want this node's attribute under that node under that node under the fifth node under that node"
Therefore, it doesn't make sense to use XPath to create a document. For that you have XmlWriter and XmlTextWriter and XmlDocument, all of which let you create XML nodes or files.
So I suppose the question for you is why do you need to change something that probably works to something else?
-
Dec 9th, 2008, 03:09 AM
#3
Re: XPath and XML
To add to that, the XPathNavigator can be used to modify or add values to a node as well.
-
Dec 9th, 2008, 09:28 AM
#4
Thread Starter
Member
Re: XPath and XML
Well, what I meant, was I am still hoping to use XmlWriter, but for some of the nodes, I will need to query other XML documents to populate those nodes. So the new XML document will have data from SQL Server 2005 and other XML docs.
I guess I was asking, since I will be using XPath, can I still use XmlWriter?
Thanks
-
Dec 11th, 2008, 03:34 AM
#5
Re: XPath and XML
Unfortunately, no, the writer was only meant to write. If you want to deal with an existing document, then you'll need to use a class that allows you to add nodes and query other nodes with XPath. So for that you can use XPathNavigator and XMLDocument.
-
Dec 11th, 2008, 09:37 AM
#6
Thread Starter
Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|