[xsd-users] segmentation fault when runninig CodeSynthesis XSD

Boris Kolpackov boris at codesynthesis.com
Tue Jul 17 08:42:43 EDT 2012


Hi Erik,

Erik Sjölund <erik.sjolund at gmail.com> writes:

> Some background information: I need to create some XML Schemas from
> within a running program. It would be possible to use Xerces for
> writing these XML Schemas, but I am interested in the possibility to
> use CodeSynthesis XSD for this.
> 
> My plan was to first write an XML schema, minimal.xsd,  that validates
> a subset of all valid XML schemas.  Then I would let CodeSynthesis XSD
> generate a dataobject model from minimal.xsd.
> 
> xsd cxx-tree --generate-serialization --root-element schema minimal.xsd
> 
> I would then use that dataobject model to write some simple XML schemas.
> 
> Is it possible to do this with CodeSynthesis XSD?

The problem with using the XML Schema namespace as target namespace is
that it messes up name lookup, fundamental namespace generation, etc,
etc.

So the way I would handle this is use some other target namespace in
the schema, save the object model to DOM and then change the namespace
to the XML Scheme namespace at the DOM level (see the 
DOMDocument::renameNode() function for details). The same logic can also
be applied to parsing, if you need this.

Boris



More information about the xsd-users mailing list