[xsd-users] polymorphism problem when serialization to xml
liyubo
liyubo at dayang.com.cn
Thu Nov 21 03:32:25 EST 2013
Oh dear Boris, Thank you sincerely.
It's my mistake. I forget the "--generate-polymorphic" option to generate the code. Now everything works correctly! Thank god thank you!
2013-11-21
liyubo
发件人:Boris Kolpackov <boris at codesynthesis.com>
发送时间:2013-11-21 16:06
主题:Re: [xsd-users] polymorphism problem when serialization to xml
收件人:"liyubo"<liyubo at dayang.com.cn>
抄送:"xsd-users"<xsd-users at codesynthesis.com>
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