[xsd-users] Default parsers for incomplete polymorphic schemas

Scott Houchin scott.houchin at aero.org
Mon Apr 2 17:06:32 EDT 2018


Hi,

I am starting to look at xsd cxx-parser as part of development of a forward compatible XML interface standard. What I want to do is define a parser that will handle all extended types as if they were the base type if the xsi:type is unknown.

As a simple example, take the example code for examples/cxx/parser/polymorphism and remove everything about batman. But still have it parse the supermen.xml file that includes that element with xsi:type=batman.

The XML document itself might still validate, but is based on a newer version of the schema than was used to generate the C++ code; but I don’t want the C++ code to outright reject the element when partial parsing would provide some information.

I am perfectly OK if the resulting behavior ignores any contained element or attribute unknown to the generic definition of the superman type, but if there was a way to allow DOM or SAX based access to the raw element, that would be preferred.

I did look at creating a custom type map, but in this case I can’t create a reliable regex to match “batman” if I also consider possible other superman subclasses like “wonderwoman” and “wolverine”.


Regards,
Scott Houchin




More information about the xsd-users mailing list