[xsde-users] XSD/e non-validating parsers and invalid XML input
Boris Kolpackov
boris at codesynthesis.com
Thu Feb 10 05:39:03 EST 2011
Hi Konstantin,
Konstantin Tokarev <annulen at yandex.ru> writes:
> I'd like to use XSD/e parser generator with --suppress-validation flag
> to produce fast non-validating parsers.
>
> Can generated code be considered as safe from segfaults in case input
> XML is not valid?
The generated code is safe but you probably won't be able to write your
application in a way that we will be safe. Just to give you an example,
consider a required element of a variable-length type. If the XML being
parsed misses this element, the object model will have a NULL pointer for
this element. But there is no easy way (API-wise) for you to determine
that this value is missing. You could generate detach functions (see the
--generate-detach option, only available in 3.2.0) and first detach
such an element to see if the returned pointer is NULL.
> If it is not well-formed?
If the document is not well-formed, you will get a parsing error. There
is no way to disable well-formedness checking.
Boris
More information about the xsde-users
mailing list