[xsd-users] (no subject)

Boris Kolpackov boris at codesynthesis.com
Mon Jul 16 15:23:23 EDT 2007


Hi Michael,

Caruso, Michael - AES <Michael.Caruso at itt.com> writes:

> Is there a way to get more descriptive exceptions from the parser?
> Right now If I purposely invalidate the XML I only receive a generic
> exception as such:
>
> "instance document parsing failed"

Yes, the easiest way is to just print the exception to cerr:

try
{
  // parsing
}
catch (const xml_schema::exception& e)
{
  cerr << e << endl;
}


For more information about error handling in the C++/Tree mapping see
Section 2.2:

http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.2

and 3.3:

http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#3.3

in the C++/Tree Mapping Manual (let me know if you are using C++/Parser).
The exception that is thrown during parsing when the document is invalid
is xml_schema::parsing (Section 3.3.1).


hth,
-boris




More information about the xsd-users mailing list