[xsd-users] How to add data to xml any type of object
Boris Kolpackov
boris at codesynthesis.com
Thu Sep 12 04:44:25 EDT 2013
Hi Albert,
Babinskas, Albert <albert.babinskas at imagingsciences.com> writes:
> <xs:complexType name="brandXml_t">
> <xs:sequence>
> <xs:any processContents="skip" namespace="##other" />
> </xs:sequence>
> </xs:complexType>
>
> [...]
>
> I don't get default constructor created for me by Codesynthesis XSD.
Yes, I see now. Your brandXml_t has a single required any wildcard.
The first constructor that you have shown expects you to pass the
value for that wildcard which, as you have shown, is awkward to
create.
As Chris suggested, the best way to resolve this is to generate
the default constructor with the --generate-default-ctor option.
Once this is done, you can populate a brandXml_t instance pretty
much the same way as in the 'wildcard' example:
brandXml_t xml;
DOMDocument& doc (xml.dom_document ());
DOMElement* e (doc.createElementSN (...));
// Serialize content to e.
xml.any (e);
Boris
More information about the xsd-users
mailing list