[xsd-users] Pointers to references
Boris Kolpackov
boris at codesynthesis.com
Fri Feb 28 10:05:01 EST 2014
Hi Mathew,
Mathew Benson <mathew.benson at gmail.com> writes:
> <SomeElement name="Object1"/>
> <AnotherElement someElementRef="Object1"/>.
If your schema uses xs:ID type for 'name' and xs:IDREF for
'someElementRef', then, yes, XSD will resolve such references
for you. See:
http://codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.5.5
> Is it generating skeletal code that I can/should modify, or should I
> treat it as autocode that can be regenerated and should not be modified
> directly?
The generated code should not be modified but there is a mechanism
for customizing the generated classes. For more information on type
customization see the C++/Tree Mapping Customization Guide:
http://wiki.codesynthesis.com/Tree/Customization_guide
As well as the examples in the examples/cxx/tree/custom/ directory.
So if ID/IDREF does not apply (i.e., your schema uses key/keyref),
then the next best thing is to customize the generated classes to
add the pointers and to initialize them in the parsing constructors.
Boris
More information about the xsd-users
mailing list