[xsd-users] Report line number when error is encountered
Boris Kolpackov
boris at codesynthesis.com
Wed Mar 2 09:49:10 EST 2011
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
More information about the xsd-users
mailing list