[xsd-users] polymorphism problem when serialization to xml
Boris Kolpackov
boris at codesynthesis.com
Thu Nov 21 03:06:47 EST 2013
Hi,
liyubo <liyubo at dayang.com.cn> writes:
> I try to modify the sample project "examples\cxx\tree\polymorphism"
> to do this.
>
> int
> main (int argc, char* argv[])
> {
> ::supermen all;
>
> ::supermen::person_sequence seqPerson;
>
> person p("Normal");
> superman s("Super",true);
>
> seqPerson.push_back(p);
> seqPerson.push_back(s);
>
> all.person(seqPerson);
>
> xml_schema::namespace_infomap map;
> map[""].schema = "supermen.xsd";
>
> supermen_(std::cout, all, map);
> }
I took the original 'polymorphism' example, replaced main() in driver.cxx
with your code above, and it works correctly. Here is what I get:
<person>
<name>Normal</name>
</person>
<superman can-fly="true">
<name>Super</name>
</superman>
So you must have also modified something else that broke things.
Boris
More information about the xsd-users
mailing list