[xsd-users] incomplet xml document handling

Boris Kolpackov boris at codesynthesis.com
Wed Sep 12 03:51:34 EDT 2007


Hi Uri,

Uri Karagila <uri at hyperroll.com> writes:

> While trying to load or dump an incomplete xml document (which is
> obviously invalid) an exception is being thrown. What options do i
> have in order to workaround this behavior?

I think your best option is to make the document valid :-). Or
you can change the schema to allow for "invalid" XML documents.
You can then check for the "real" validity in the application
when it is required.

Even when you disable XML Schema validation in the underlying XML
parser (the dont_validate flag), XSD-generated code still contains
a number of checks that would prevent construction of an inconsistent
object mode. One such check is for the required attribute or element
If this check was not present then you could get an object model for
which you have no way to test whether a required attribute/element
is there and if you tried to access it you would end up with an
application crash. I don't think anybody expects this kind of
behavior.

To give you more information on your particular situation we will
need to know which exception is thrown and how invalid the XML
document is.

Boris




More information about the xsd-users mailing list