[xsd-users] Help me: How do I redirect the exception message
from console output to a memory buffer
boris at codesynthesis.com
Fri Oct 16 04:52:44 EDT 2009
James Mei <jxmei3 at gmail.com> writes:
> May I know how do I get/redirect the exception message (mainly for
> validation), from cerr to a memory buffer so that I can pipe to a file
> or reformat it on the screen ?
You can use std::ostringstream to serialize the diagnostics to a string.
You can also programmatically access each parsing/serialization diagnostics
message by catching the xml_schema::parsing and/or xml_schema::validation
exceptions and using their accessors to extract this information. For
details, see Section 3.3, "Error Handling" in the C++/Tree Mapping User
More information about the xsd-users