[xsd-users] --generate-comparison and anyType

Boris Kolpackov boris at codesynthesis.com
Mon Oct 11 12:18:36 EDT 2010


Hi Ray,

Ray Lischner <rlischner at proteuseng.com> writes:

> We are using Code Synthesis 3.3.0. When I use --generate-comparison and 
> an element has type anyType, the generated comparison function does not 
> compile because xml_schema::type does not have the == operator. I don't 
> know what it means for an anyType to == an anyType, so I don't know the 
> solution to this problem,

That's the reason why we left the comparison operators for anyType and
anySimpleType unimplemented. 

There are two common scenarios where anyType would be used:

1. In polymorphic schemas anyType can be used as an abstract root of a 
   type hierarchy. In this case an instance of anyType is actually never
   created so the comparison operator can safely return false.

2. anyType is used as a "match anything" kind of wildcard. In this case
   the application either ignores the content in which case the comparison
   operator should probably always return true or the application customizes
   anyType in which case it should provide its own comparison implementation.

If we provided the default implementation, it would be impossible for the
application to provide its won version that meets the requirements of one
of the above scenarios.


> but I think it a real problem when a valid schema compiles to invalid 
> C++ without a peep from xsd.

Yes, I thinks issuing a warning would be a reasonable thing to do. Added
to the TODO list.

Boris



More information about the xsd-users mailing list