[xsd-users] Extended exception information

David White dawhite32 at gmail.com
Fri Apr 17 00:52:52 EDT 2009


Dear Boris,

Consider a complex type defined as follows:

<xs:complexType>
  <xs:sequence>
    <xs:element ref="X"/>
    <xs:element ref="Y"/>
    <xs:element ref="Z"/>
    <xs:element ref="Position" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

If I attempt to parse an XML file which has the X, Y, Z in a different
order, for example:

<Position>
  <Y>63.745</Y>
  <Z>200.809</Z>
  <X>-186.489</X>
</Position>

I get an "instance document parsing failed", which is what I expect to
get. No problems there.  My question is - how do I get extended
exception information as to where the error is?  I am trapping the
exception via:

catch (const ::xml_schema::exception& e)
{
    // print message
    cerr << e.what() << endl;
}

Is there another class that will give me extended information?

Thanks in advance.

Kind regards, David.




More information about the xsd-users mailing list