[xsd-users] Moving over to c++11

Boris Kolpackov boris at codesynthesis.com
Mon Mar 27 09:25:39 EDT 2023


Paul McGrath <paul.s.mcgrath at gmail.com> writes:

> I was able to get below generated if I DON'T use the
> "--generate-element-type" flag. Is this normal behavior? I would like to
> use that flag.

Yes, this is the expected behavior, per Section 2.9.1, "Element Types"[1]:

"Unlike parsing and serialization functions, element types are only 
capable of parsing and serializing from/to a DOMElement object. This
means that the application will need to perform its own XML-to-DOM
parsing and DOM-to-XML serialization. The following section describes
a mechanism provided by the mapping to uniformly parse and serialize
multiple root elements."

The mechanism this section refers to is Element Map[2] (enabled with
--generate-element-map, which you also seem to pass).

You can find sample code for parsing/serializing XML-to/from-DOM in the
`messaging` example[3].

[1] https://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.9
[2] https://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.9.2
[3] https://git.codesynthesis.com/cgit/xsd/xsd/tree/xsd-examples/cxx/tree/messaging



More information about the xsd-users mailing list