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

Alberto Colombo a.colombo at kingston.ac.uk
Fri Jan 25 05:29:08 EST 2008


Hello,

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:

class KanannotateHelper
{
public:

	KanannotateHelper(std::string layout_filename) throw
(xml_schema::exception);

	KanannotateHelper (std::string, std::auto_ptr<ka::TopologyType>);
	
	// ...
};

where ka::TopologyType is generated by XSD. In my main, I can do like
this:

	std::auto_ptr<ka::TopologyType> topology;
	topology = ka::topology(layout_file);
	KanannotateHelper kh(layout_file, topology);

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. This happens on a normal SuSE system, no MPI
involved (it's a dual core, indeed, but does that matter?).

I did not dwell on the problem since I found an easy workaround, but I
thought it may be of interest to others...

Many thanks to Boris and the XSD team for their time and their software.
Best Regards
Alberto

On Wed, 2008-01-23 at 11:35 +0200, Boris Kolpackov wrote:
> Hi Mark,
> 
> Mark Capogreco <mcapogreco at hotmail.com> writes:
> 
> > I received the above error running an C++ openMPI parallel application,
> > which is an extension to my previously normal C++ app. Which worked well
> > with XSD. The following is a description of what has occurred.
> >
> > -          I run my C++ app. Fine utilising XSD with no error.
> >
> > -          I added openMPI code and still run well under normal C++
> > environement.
> >
> > -          I tried then running the C++ app on the Parallel Tools Platform
> > in eclipse 3.2 using only one node and received the above error.  The same
> > error occurs for several nodes.
> >
> > I was hoping someone could give me some detail on the error so I can see why
> > I can't input my parameters using XSD in the parallel environment.
> 
> The invalid_utf8_string exception is thrown by the text conversion
> function when an invalid UTF8 character or character sequence is
> encountered. One thing to note is that this should only happen when
> you try to serialize the object model to XML (that's when UTF-8 to
> UTF-16 conversion is happening). So if all you are doing is parsing
> XML to object model then the fact that you are getting this exception
> is very strange.
> 
> If you do serialize to XML then the most likely reason for this
> exception is that a string in the object model contains invalid
> UTF-8 text. Seeing that you are running in a parallel environment,
> perhaps there is a race condition which gobbles up the data.
> 
> One way to try and track down the problem would be to get a stack
> trace (e.g., by getting a core and examining it with gdb). This
> way you can actually examine the string being converted which
> should give you a better idea about what's going on.
> 
> Boris
> 
> 
> This email has been scanned for all viruses by the MessageLabs Email
> Security System.
-- 
Alberto Colombo, MSc

PhD student at Digital Imaging Research Centre
Kingston University, London

e-mail: a.colombo at kingston.ac.uk
  cell: +44 77267 11980
  http://dircweb.king.ac.uk/Ris/queries/pages/home_page.asp?AuthorID=925

This email has been scanned for all viruses by the MessageLabs Email
Security System.




More information about the xsd-users mailing list