Opinion on XML data access

P

p0

Hello,

I'm looking on opinions on data access in .Net. I have an xsl file
containing a xsl:variable with child nodes. I want to create a GUI to
manipulate the content of these child nodes.

Should I load the node in memory as an XmlNode and manipulate its
content directly for every get/set operation? Or should I
'deserialize' the node into several data classes and 'serialize' at
the end of all the getting and setting?

From a performance point of view, neither of those two options should
form a problem. I'm just wondering about 'good practice'.

TIA,

Yves
 
M

Martin Honnen

p0 wrote:

Should I load the node in memory as an XmlNode and manipulate its
content directly for every get/set operation? Or should I
'deserialize' the node into several data classes and 'serialize' at
the end of all the getting and setting?

From a performance point of view, neither of those two options should
form a problem. I'm just wondering about 'good practice'.

I am not sure it is a question of good practice. Use the API you are
more familiar with. If you are familiar with the DOM implementation in
the .NET framework (i.e. System.Xml.XmlDocument/XmlElement/XmlNode) then
you should have no problems in using it for the task. If you have no
experience with the DOM then using XmlSerializer to allow you to work
with instances of custom .NET classes can be much more comfortable.
 
C

Cor Ligthert[MVP]

As good practise the latter is in my idea definitly better
(deserialize/serialize) because then your program becomes easier to
understand and therefore to maintain.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top