[xsd-users] Report line number when error is encountered

Boris Kolpackov boris at codesynthesis.com
Wed Mar 2 09:11:57 EST 2011


Hi Alessandro,

Alessandro Carpi <alessandro.carpi at gmail.com> writes:

> It would nice if, when this kind of errors are encountered (aka. expression
> parser returns a null pointer because is written wrongly) , the XML parser
> prints the XML line of the wrong expression.

In other words you want to get the line/column information of the current
position so that you can print it together with your application-specific
error.

The way to get to this information depends on the underlying XML parser
you are using (Expat or Xerces-C++). But the general approach would be
to create the parser yourself, then use this parser to parse the document
and query it for the current line/column information in case of an error.
This is fairly easy to implement with Expat and slightly more difficult
with Xerces-C++.

Boris



More information about the xsd-users mailing list