[xsd-users] comparison question

Rizzuto, Raymond Raymond.Rizzuto at sig.com
Mon Jun 30 15:28:43 EDT 2008


Boris,

Thanks for the suggestion about type customization.  I'll look into
that.  It sounds like I may be able to

1) make the compiler generate MessageType_base
2) derive my MessageType from MessageType_base
3) repeat #1 and #2 for the 36 types derived from MessageType
4) implement operator== for MessageType and have it call a virtual
compare function
5) implement virtual compare function in the derived classes of
MessageType

Ray

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com]
Sent: Monday, June 30, 2008 12:41 PM
To: Rizzuto, Raymond
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] comparison question

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

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.




More information about the xsd-users mailing list