[xsd-users] How to add data to xml any type of object

Babinskas, Albert albert.babinskas at imagingsciences.com
Thu Sep 12 08:16:57 EDT 2013


Thank you Boris and Chris.


-Albert

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Thursday, September 12, 2013 4:44 AM
To: Babinskas, Albert
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] How to add data to xml any type of object

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


Please be advised that this email may contain confidential 
information.  If you are not the intended recipient, please notify us 
by email by replying to the sender and delete this message.  The 
sender disclaims that the content of this email constitutes an offer 
to enter into, or the acceptance of, any agreement; provided that the 
foregoing does not invalidate the binding effect of any digital or 
other electronic reproduction of a manual signature that is included 
in any attachment.





More information about the xsd-users mailing list