[xsd-users] Parsing XML string to tree object issue

Tolga Hakan ODUNCU thakanoduncu at gmail.com
Fri Mar 27 06:08:29 EDT 2020


Dear xsd group members,
Hello, I have a few questions about parsing xml string data. With your
support to my previous mail I managed to serialize my tree objects to xml
string, however I cannot make reverse now.

According to the user manual, a simple code sample is proposed for parsing
xml string data to tree object (Section 3.5).
{
  std::string str ("..."); // Some XML fragment.
  std::istringstream iss (str);
  auto_ptr<type> r (name (iss));
}

When I want to use this sample with my own types as follows,
{
    std::istringstream iss (requestContainerStr);   //  requestContainerStr
is a string that has valid xml format.
    std::unique_ptr<Etsi103221::RequestContainer> xsd_RequestContainer
(Etsi103221::X1Request (iss));
}

I get the exception "instance document parsing failed"

My question is that, are generated codes with cxx-tree command sufficient
for this parsing operation, or do I also need to generate parser codes with
cxx-parser command.
The user manual (
https://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/)
does not have any statement about generating parser. I noticed the
cxx-parser command on the Compiler Command Line Manual (
https://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml)

Thanks for your support.
Kind Regards,
Tolga Hakan Oduncu


More information about the xsd-users mailing list