I'm attempting to serialize XML data using a schema validator in C++. I'm getting an error message. I can report the message like this:
std::cout << exception.what() << std::endl;
Returns:
'error parsing: unable to validate schema'
However, when I do this:
std::cerr << exception.what() << std::endl;
I get a substantially more detailed report including specific parsing errors. I would like to pipe the output reported to cerr
to a variable for logging, but I don't know how to do that.
Any ideas?
Edit
The exception class I'm using is actually a typedef
custom XSD parse exception. The exception is not a std::exception
type. I'm wondering if the authors of the XSD code overloaded the <<
operator to provide different outputs depending on the ostream
type. Does this make sense? I've never seen that before.