[xsde-users] XSD/e non-validating parsers and invalid XML input

Boris Kolpackov boris at codesynthesis.com
Thu Feb 10 09:50:24 EST 2011


Hi Konstantin,

Konstantin Tokarev <annulen at yandex.ru> writes:

> > 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. 
> 
> Is there a chance it will be possible in some future version?

Unlikely. Trying to transform an invalid document to something usable
is an open-ended problem. Even if we were to try and support something
like this, it will complicate the API and result in slower and larger
generated code, which will be a significant drawback for the majority
of applications.


> For example, if document is unfinished (some information loast at the end so there
> are unclosed opening tags), will it be possible to parse available data?

You can do something like this with a partially event-driven, partially in-
memory processing. See the 'streaming' example as well as Section 4.8, 
"Customizing the Object Model" and Section 6.1, "Customizing Parsers and
Serializers" in the Embedded C++/Hybrid Mapping Getting Started Guide.

Boris



More information about the xsde-users mailing list