[xsd-users] xerces exceptions
Leonid Gershanovich
gleonid at yahoo.com
Tue May 11 17:09:37 EDT 2010
>Hi Eric,
>
>Eric Niebler <eric at boostpro.com> writes:
>
>>I've discovered (a bit too late sadly) that xsd lets xerces exceptions
>>propagate. Ideally, I'd like to deal exclusively with std and xsd types>>and not let any xerces types leak into my code. Is there an option to
>>have xsd catch and translate xerces exceptions?
>
>No, no such option yet. Though I agree we should do it and I have
>added an item to the TODO list.
>
>What can make it less of a problem is the fact that only "hard"
>errors are reported by Xerces-C++ as exceptions (e.g., an out of
>memory condition). Things like XML parsing errors are handled via
>error handlers and are translated by the XSD-generated code.
Hi, Boris,
as long as exceptions are being discussed here I want to ask slightly another question.
While looking at CodeSynthesis code (version 3.2.0) I have noticed that under certain conditions generated code throws a variaty of exceptions.
Some of those exceptions are derived (directly or indirectly) from std::exception:
1. xsd::cxx:tree::_type::bad_dom_node_type
2. xsd::cxx:tree::_type::not_registered
3. xsd::cxx::tree::ace_cdr_stream_extraction
4. xsd::cxx::tree::ace_cdr_stream_insertion
5. xsd::cxx::tree::bounds<C>
6. xsd::cxx::tree::duplicate_id<C>
7. xsd::cxx::tree::expected_attribute<C>
8. xsd::cxx::tree::expected_element<C>
9. xsd::cxx::tree::expected_text_content<C>
10. xsd::cxx::tree::no_prefix_mapping<C>
11. xsd::cxx::tree::no_type_info<C>
12. xsd::cxx::tree::parsing
13. xsd::cxx::tree::xdr_stream_extraction
14. xsd::cxx::tree::xdr_stream_insertion
15. xsd::cxx::parser::parsing
Also there is a group of exceptions that has a common parent (xsd::cxx::parser::schema_exception), but not derived from std::exception:
1. xsd::cxx::parser::dynamic_type<C>
2. xsd::cxx::parser::validating::expected_attribute<C>
3. xsd::cxx::parser::expected_element<C>
4. xsd::cxx::parser::validating::invalid_value<C>
5. xsd::cxx::parser::validating::unexpected_attribute<C>
6. xsd::cxx::parser::validating::unexpected_characters<C>
7. xsd::cxx::parser::unexpected_element<C>
And there is another set of exceptions, which are essentially an empty struct declarations:
1. xsd::cxx::xml::sax::std_input_source::copy {}
2. xsd::cxx::xml::properties<typename C>::argument {}
3. xsd::cxx::parser::buffer::bounds {}
4. xsd::cxx::xml::invalid_utf16_string {}
5. xsd::cxx::xml::invalid_utf8_string {}
I briefly checked CodeSynthesis version 3.3.0 and in most cases it seem the same.
So my questions are:
1. Have you considered to make all exceptions in CodeSynthesis to be derived from std::exception?
2. What was the original reason not use std::exception?
Thanks in advance
Leonid Gershanovich
More information about the xsd-users
mailing list