What's the alternative to XmlDataDocument?

  • Thread starter Thread starter Marc Hillman
  • Start date Start date
M

Marc Hillman

I just discovered XmlDataDocument today, which is the perfect solution to my
problem, but I've just realised that it is obsolete. So what's its
replacement? I wish to access an XML file both via XPath and DataSets. What
options do I have?
 
Marc said:
I just discovered XmlDataDocument today, which is the perfect solution
to my problem, but I've just realised that it is obsolete. So what's its
replacement? I wish to access an XML file both via XPath and DataSets.
What options do I have?

Why can't you use Linq-2-XML?

<http://msdn.microsoft.com/en-us/library/bb675156.aspx>

Why do you need a dataset at all? You don't need one if using
Linq-2-XML. You just query the XML and load it into a kind of result set
and you use that instead of the dataset.
 
I've only just realised that I don't need XmlDocument at all. My plan is
that I load the XML into a DataSet, manipulate the data in a DataSet, and
then write the DataSet out in XML when I finish.

Two advantages for me
1. I can bind the dataset tables to datagridviews, and
2. I'm much happier dealing with relational data than navigating XML.

It all seems to be working, so if there is a flaw in my plan, please let me
know.
 
Marc said:
I've only just realised that I don't need XmlDocument at all. My plan is
that I load the XML into a DataSet, manipulate the data in a DataSet,
and then write the DataSet out in XML when I finish.

You can manipulate the queried result of the Linq-2-XML query, do CRUD
operations against the result, and write the result out as a XML file
all by using Linq-2-XML. You don't need a dataset to do anything.
Two advantages for me
1. I can bind the dataset tables to datagridviews, and

You can do that with Linq-2-XML, query the XML using Linq-2-XML, bind
the result to a control, and you don't need a dataset period.

2. I'm much happier dealing with relational data than navigating XML.

By using Linq-2-XML, one can treat the XML as relational data.
It all seems to be working, so if there is a flaw in my plan, please let
me know.

Linq is the new boy on the block and is very powerful -- very powerful
indeed. Dataset is old technology.
 
Hello ,

I use nowadays only use XDocuments when dealing with XML , LINQ makes it
as easy as querying against a database

regards

Michel
 
Back
Top