[xsd-users] comparison question
Boris Kolpackov
boris at codesynthesis.com
Mon Jun 30 12:41:08 EDT 2008
Hi Ray,
Rizzuto, Raymond <Raymond.Rizzuto at sig.com> writes:
> I actually think the comparison functions are useful for people that are
> creating XML documents for exactly this kind of round trip validation.
> However, I won't be able to use it as is without a polymorphic
> comparison.
Ok, I've added this to out TODO list for 3.1.1. I will give it
some more thought and see if there is an acceptable solution.
> Since that would have to be a member function, adding it would
> require changing the generated code. That sounds like a
> maintenance nightmare.
Actually, the type customization mechanism in C++/Tree is there
to solve exactly this kind of problems. See the C++Tree Mapping
Customization Guide for more information:
http://wiki.codesynthesis.com/Tree/Customization_guide
In particular, the custom/taxonomy example shows how to add a
virtual function to a hierarchy of types. It even uses
polymorphism. I agree this is a bit more work than to have the
XSD compiler generate proper comparison operators but it can be
done in a maintainable manner if you really need it.
Boris
More information about the xsd-users
mailing list