[xsd-users] Parsing and validation from CDR stream
boris at codesynthesis.com
Fri Aug 6 09:24:16 EDT 2010
Romain <rc.mail.dev at gmail.com> writes:
> One part of my application serializes C++ data to CDR. For what I
> understand, there is no validation at this stage.
> The other part of my application receives the CDR data, deserializes the CDR
> to C++ data (also no validation at that stage correct?).
> That's why I need the validation, because there might be some invalid data
> (boundaries errors, etc.).
Just to clarify, there cannot be CDR-related errors (that's what I assume
you refer to by "boundaries errors") since the CDR insertion/extraction
code is auto-generated from a valid schema. If you detect such errors
then that means there is a bug in the XSD compiler.
You can get an invalid object model after extracting it from CDR only if
the object model that was saved to CDR on the other end was already invalid
(e.g., an invalid XML file was parsed with validation disabled or an invalid
object model was created programmatically).
> Any other suggestions on how I could handle this case?
If you still need to validate the result of the CDR extraction then
the only way is to serialize the object model to XML and then re-
parse it with validation, as outlined in my previous email.
If this doesn't work for you then you can take a look at the C++/Hybrid
mapping in XSD/e. It also supports CDR streams and you can validate
the object model during parsing and serialization. The idea is to
run a validating serializer on the object model with no-op writer
More information about the xsd-users