DataSet or Classes
Question posted by: Ruslan
(Guest)
on
November 11th, 2005 10:49 PM
I must work with the xml files. Load data from xml, change it, save it. What
is the best idea? To use ADO.NET, I mean to load data from xml to DataSet,
or create classes and work with these classes (something common with
"Castor").
Thanks,
Ruslan
2
Answers Posted
Ruslan,
It depends.
Are you familiar with DataSets and does your data map easily to them?
If so, use the DataSet.It's a great interface. However, it won't handle all
XML data structures.
A good alternative is the XML DOM.
Kathleen
"Ruslan" <ruslan_albu@hotmail.com> wrote in message
news:ugTVDG5SDHA.2256@TK2MSFTNGP11.phx.gbl...[color=blue]
> I must work with the xml files. Load data from xml, change it, save it.[/color]
What[color=blue]
> is the best idea? To use ADO.NET, I mean to load data from xml to DataSet,
> or create classes and work with these classes (something common with
> "Castor").
>
>
>
>
>
> Thanks,
>
>
>
> Ruslan
>
>[/color]
I would recommend trying the Xml Serialization mechanism.
(not quite like Castor, something more like JAXB, or what JAXB wuold like to
be).
It works for most of the basic cases and you may find it sufficient.
In fact though you don't explicitly work with XML when using this mechanism.
In your code, you work with objects. You read and save the objects, and the
XML is slurped in, or emitted, auto-magically. In your code you would never
touch the DOM or refer to an XmlNode etc.
-Dino
"Steve B. [Labo.Net]" <n.o.s.p.a.m.steve.beauge@supinfo.com> wrote in
message news:%23lYddM7SDHA.632@tk2msftngp13.phx.gbl...[color=blue]
> You can also use serialisation ...
> Create a class using same property than your xml file, and use[/color]
serialization[color=blue]
> / deserialization to convert object->xml et xml->object.
> Unfortunetally, all xml file cannot be used using this technic
>
> Steve
>
> "Ruslan" <ruslan_albu@hotmail.com> a écrit dans le message de
> news:ugTVDG5SDHA.2256@TK2MSFTNGP11.phx.gbl...[color=green]
> > I must work with the xml files. Load data from xml, change it, save it.[/color]
> What[color=green]
> > is the best idea? To use ADO.NET, I mean to load data from xml to[/color][/color]
DataSet,[color=blue][color=green]
> > or create classes and work with these classes (something common with
> > "Castor").
> >
> >
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Ruslan
> >
> >[/color]
>
>[/color]
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 196,790 network members.
Top Community Contributors
|