[xsde-users] Re: Using polymorphism
Frenk Stih
iknerf.dream at gmail.com
Mon Sep 7 06:13:19 EDT 2015
Dear Sir,
The issue was solved, thanks to the documentation and available examples.
Best regards, Frenk
2015-09-06 8:17 GMT+02:00 Frenk Stih <iknerf.dream at gmail.com>:
> Hello xsde,
>
>
> I am starting using you xsde and have also check the forum, but could
> not found the issue to my problem.
>
> I am working on linux and using latest 3.2.0 xsde version.
>
> I have created parser with the following scheme
> <xs:complexType name="MsgHeader">
> <xs:sequence minOccurs="1" maxOccurs="1">
> <xs:element name="HDR" type="Header" />
> </xs:sequence>
> </xs:complexType>
> <xs:element name="MsgHdr" type="MsgHeader"/>
> <!-- ACK.R01 Message [6.2] ================================================ -->
> <xs:complexType name="MsgAcknowledgement">
> <xs:complexContent>
> <xs:extension base="MsgHeader">
> <xs:sequence>
> <xs:element name="ACK" type="Acknowledgement"
> />
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> <xs:element name="ACK.R01" type="MsgAcknowledgement"
> substitutionGroup="MsgHdr" />
>
> and using xsde options:
> --cxx-hybrid --generate-parser --generate--aggregate
> --generate-polymorphic --root-element MsgHdr --polymorphic-type MsgHdr
>
> I then try to use the MsgHdr_paggr and could parse just HDR xml
> messages. In the paggr there is also no pre() method? Is this ok,
> because when I have read your online help and polymorphic example the
> pre() should exists. I then tried to work on pimpl only and
> MsgHeader_pimpl can also parse only HDR xml message, even if I set
> polymorphic to true and use parsers_map.
>
> Everything is fine when parsing the MsgHeader message, but when trying
> to parse the MsgAcknowledgement message I always get an error in the
> part starting <ACK>:
> <?xml version="1.0" encoding="UTF-8"?>
> <ACK.R01>
> <HDR>
> <HDR.control_id V="4001"/>
> <HDR.version_id V="POCT1"/>
> <HDR.creation_dttm V="2001-11-01T16:30:01-0800"/>
> </HDR>
> <ACK> <-- Here I get error "unexpected element encountered"
> <ACK.type_cd V="AA"/>
> <ACK.ack_control_id V="10001"/>
> </ACK>
> </ACK.R01>
>
> I can parse this message if I use MsgAcknowledgement_pimpl, so I
> assume the parser is ok.
>
> The example code I am working:
>
> MsgHeader_pimpl hello_p;
> MsgAcknowledgement_pimpl ack_p;
> xml_schema::parser_map_impl p_map(3);
> p_map.insert(hello_p);
> p_map.insert(ack_p);
> std::cout << "test parsing POCT message" << std::endl;
> xml_schema::document_pimpl doc_p(hello_p,
> "MsgHdr",
> true );
> std::cout << "test calling pre() of XSDe parser" << std::endl;
> hello_p.pre ();
> std::cout << "test perform parse()" << std::endl;
> doc_p.parse (argv[1]);
>
> Did I miss something?
>
>
> Thanks for any advice, Frenk
More information about the xsde-users
mailing list