[xsd-users] terminate called after throwing an instance of 'xsd::cxx::xml::invalid_utf8_string'

Boris Kolpackov boris at codesynthesis.com
Fri Jan 25 08:14:13 EST 2008


Hi Alberto,

Alberto Colombo <a.colombo at kingston.ac.uk> writes:

> I have the same problem, with this unusual exception being thrown when
> I try to *parse* a document. I have a class defined like this:
>
> [...]
>
> And it works fine, using the second constructor. On the other hand, if I
> try to use the first constructor:
>
> 	KanannotateHelper kh(layout_file);
>
> which is defined as
>
> KanannotateHelper::KanannotateHelper (string _layout_filename) throw
> (xml_schema::exception) : layout_filename( _layout_filename ),
> topology( ka::topology( layout_filename ) )
> {}
>
> I get the exception thrown.

Hm, interesting. There is only one place where the UTF-8 to UTF-16
conversion code is called in case of parsing a file identified by
name or a URI and that is the code that converts the file name/URI
to UTF-16. So the only reason why this exception would be thrown is
if the file name string was invalid.

In your case what immediately comes to mind is the possibility that
the layout_filename and topology member variables are initialized
in the wrong order. In this case you would be using layout_filename
which hasn't been constructed yet and would therefore contain
garbage which, in turn, would most likely trigger the exception.
Can you confirm that layout_filename is declared before topology
in KanannotateHelper class?


Boris




More information about the xsd-users mailing list