[xsd-users] Serialize elements to xml with no namespace decorations

Boris Kolpackov boris at codesynthesis.com
Mon Mar 5 09:51:48 EST 2012


Hi James,

James & Veri Martin <verimart at hotmail.com> writes:

> I have a case where I need to be able to serialize out to an XML file
> incrementally as data is made available rather thanloading an entire object
> model into memory and then write the whole thing out in one go.  For
> example, I'd like to create a file, write out the opening tag for the root
> node, then make multiple callsto the ostream functions to write out new
> child elements as the data is made available.  Once all the data'sbeen
> processed, close out the root node tag and call the file complete.  Is this
> usage model supported by the generated code?

Yes, see the 'streaming' example.

> I've been trying, for example, to just serialize a single element with 
> no namespace decorations whatsoever on theelements, but the default code
> always inserts namespace information.

This is a Xerces-C++ limitation that we are planning to fix for the next
release (i.e., allow serialization of an XML fragment as if it was in
a context of some outer element). For now, depending on how your schema,
uses XML namespaces, you may have to live with some extra namespace 
information.

Boris



More information about the xsd-users mailing list