[xsd-users] xml_schema::expected_element exception during
DOM-Tree stage
Boris Kolpackov
boris at codesynthesis.com
Thu Nov 12 08:18:00 EST 2009
Hi,
Homer J S <js.homer at yahoo.com> writes:
> Hi, since the DOM-Tree stage reports error conditions exclusively by
> throwing exceptions my program stops cold whenever the
> xml_schema::expected_element exception is raised by the parser.
> What could I do to get the parser to continue parsing even when
> encountering this condition (I dont have much control over the
> contents of the xml string to be parsed).
The C++/Tree generated code performs a subset of XML Schema validation
to make sure the resulting object model is consistent. Without such
checks, for example, you could get an object model with a missing
required element value. Since there is no way to check whether such
a require element value was actually set, accessing this object model
will lead to an application crash.
The only way to work around this that I can see would be to "fix up"
the otherwise invalid XML in DOM (before passing it on to the DOM-Tree
stage) by making sure that all the required elements and attributes are
present.
Boris
More information about the xsd-users
mailing list