473,379 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Object2XML ?

I have a fairly simple request. I want to convert an
object into an XML element.

I am familiar with XmlSerializer. The drawback here is that
it creates a complete, well-formed XML document.

In the end, the goal is to archive several groups of objects
in XML files, where each XML document contains many instances of
the objects as element nodes. These collections might be very
large, and the contents of the objects themselves of variable length.

The individual files(groups) could be likened to

class ProductOrder{
...stuff of the object
}

The XML files would be

orders.xml
processed.xml
rejected.xml

The productOrder, once filled needs to be added (as an element) to orders.xml.
When a product order is processed it needs moving to processed.xml
If a order is rejected int needs moving to rejected.xml

I have no problem with the operations needed for the complete XML elements.

What I am looking for is a convenient way to move the objects into and out of
XML. I really don't want to hand-roll a custom writer for the class object.
That would defeat the purpose.

I could use XMLSerializer into a stream directed into a reader and grab
the element(I suppose) but I thought there might be something more direct.
There are hints everywhere that this is a common task supported somewhere.

Sorry if this is a dumb question. I have searched for some time now but
the sheer volume of new classes supporting XML is getting in the way.

The thought has occurred to me that like my first stuttering attempts
with objects(back in the late 80's) that my approach is wrong-headed.
Maybe I shouldn't be using XML for this, or...?

If there was one criticism I would levy at all if it, it's the lack of
bootstrap material. "books.xml" is swell, but where did it come from?
I mean, no one's going to sit there and type that stuff out as a source
for a real system with thousands of books, are they?

regards,

bullshark

Nov 15 '05 #1
0 959

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.