[xsd-users] Question about xsd

Boris Kolpackov boris at codesynthesis.com
Sat Jan 27 14:35:43 EST 2007


Hi Gregorio,

I am glad things are working for you now!


Gregorio Arvilla <Gregorio.Arvilla at epvgroup.com> writes:

> I have a question about xsd. How do I create an empty instance of the
> xsd generated code and fill it with data myself (instead of the data
> coming from an xml file)?

You would start by instantiating the type that corresponds to the
root element and then use this type's modifiers that correspond
to elements and attributes to "grow" your tree. In case of the
hello example, you could do it like so:

hello_type h ("Hey"); // Construct the hello object with
                      // the greeting string.

h.name ().push_back ("Boris");   // Add a few names
h.name ().push_back ("Gregorio");


Also see the library example for some more sample code that modifies
the in-memory representation.


hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070127/afcfe947/attachment.pgp


More information about the xsd-users mailing list