xml manipulation -- dataset or dom???

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi,

I have been doing a bit of work lately with xml.

I have been using the xmldocument class to manipulate the DOM,

I was wondering if I would be better to just to manipulate the xml as a
dataset (just adding, deleteing, updating rows)
or whether I should just stick to the xmldocument method.

while the dataset would be easier to use, i not sure how effiient it would
be.

cheers

martin.
 
Hi Martin,

The DataSet is serializble into XML, but it is not XML. It has to be
serialized and de-serialized. In addition, the DataSet is designed
specifically to be used with tabular data. Furthermore, the DataSet is
designed to work with multiple tables. A DataTable is a much more
lightweight container. Still, the point I'm getting at is this: What the
DataSet represents is an implementation of state and process that interacts
with XML for a specific, albeit broad, number of uses.

The point I'm trying to make is, you began your message by saying that you
"have been doing a bit of work lately with xml." And you further stated that
you have been "using the xmldocument class to manipulate the DOM." Now, your
question is well-taken, in that you don't want to continue having to write a
lot of relatively low-level code to work with the XML your requirements
dictate that you work with. And that naturally leads to the question of
whether (in more abstract terms) there is a class or set of classes that can
hide this complexity and increase your productivity (not necessarily "be
easier to use," but in the long run it amounts to ALMOST the same thing).

Now, this is where the beauty of OOP and the CLR come into play. You have
already been using the CLR to build classes, although you may think of them
in a more aggregate way as "applications." But the DataSet is a perfect
model for what you need to be thinking about: It is a tool developed by
using smaller tools, for the purpose of increasing productivity when working
with a specific set of criteria, among with is serializability to XML.

So, rather than asking yourself, "does the scope of what this rather
largely-scoped tool encompass what I'm working on without adding too much
overhead," you should be asking yourself "can I build a similar, reusable
tool that is leaner than a DataSet, more specifically suited to my present
and possibly future projects that are similar, and enables me to work on the
type of XML objects that I need to work on?" And when you think of it that
way, the answer is, of course, yes.

And that is what I recommend you do. In the 4 or 5 years that I have worked
with .Net, I have built a dozen or more class libraries of tools that I can
employ in my applications and make them work in a more or less uniform way,
as well as preventing me from having to re-invent the wheel whenever I run
into a similar situation. That is what the .Net platform is for. And it is
what OOP is all about.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.
 
Back
Top