[xsd-users] type inheritance/substitution and generated class interface

Sumant Tambe sutambe at dre.vanderbilt.edu
Tue Dec 1 16:52:40 EST 2009


Hi,

I've some follow-up questions on a xsd-users thread that is over 4 years 
old! Here's a URL:
http://www.codesynthesis.com/pipermail/xsd-users/2005-September/000026.html

1. Once the XML is parsed and and in-memory object model is created, how 
do I downcast from base to derived type? Specifically from the example, 
how do I know that a Person is in fact a Superman and get a Superman 
type of object from the Person object. I tried dynamic_cast thinking 
that person object reference might be polymorphic, but it does not seem 
to work.

2. Does substitutionGroup have any effect on the generated class 
interface? Again from the example, if Superman is part of the Person 
substitution group, is it possible (or does it makes sense) to have a 
separate member function called superman that returns only supermen?
If not, how do I casting in this case?

Thanks,

Sumant.



More information about the xsd-users mailing list