[xsd-users] Report line number when error is encountered
Alessandro Carpi
alessandro.carpi at gmail.com
Wed Mar 2 11:40:11 EST 2011
2011/3/2 Boris Kolpackov <boris at codesynthesis.com>
> Hi Alessandro,
>
> Alessandro Carpi <alessandro.carpi at gmail.com> writes:
>
> > Actually yes. I was thinking to throw a sort of "not valid xml
> exception"
> > in order to obtain the printing of line and column for free :-)
>
> Yes, this approach is probably the easiest. Simply derive your own
> exception
> class from schema_exception like this:
>
> #include <xsd/cxx/parser/schema-exceptions.hxx>
>
> struct my_exception: xsd::cxx::parser::schema_exception<char>
> {
> virtual std::string
> message () const
> {
> return "...";
> }
> };
>
> And throw it from one of the callbacks. You should then see the message
> along
> with the file/line/column information as if it was an XML validation error.
>
> Boris
>
Thank you! It is exactly what i need :-)
--
--
Alessandro Carpi
More information about the xsd-users
mailing list