0

What is the actual difference between Parsing and Validation? As parsing itself can recognise the message structure ,why should we go for validation?

Parsing itself throws error if the message is not as per the structure defined for MRM parser,then why validation property has to be set with "content and value"?

Rad4
  • 1,936
  • 8
  • 30
  • 50

1 Answers1

3

Firstly only parsers with a message model can validate, so that is XMLNSC/SOAP (with a schema), MRM, DFDL and DataObject.

For XMLNSC based parsers without validation the message will be treated as self defined and an exception will be thrown only if the message is not well formed.

With validation enabled XMLNSC based parsers will validate that the message adheres to the emssage model and will check all restrictions / schema facets defined in the schema for validity.

The DFDL and MRM are model based parsers, there is no way to use these parsers without a message model so they always check the message content against the model. A non-validating parse with these parsers have stronger constraints than an XMLNSC based parser. With validation disabled these parsers check that the data can be interpreted as an instance of the model.

When validating the MRM and DFDL parsers will additionally check value constraints, correct data is of the correct type and check ordering constraints.

Dave
  • 633
  • 4
  • 6
  • As you have explained,if data is interpreted as an instance of the model in mere parsing itself,it looks like,it will still validate the content and value and order.Otherwise,the instance will fail against the modal,then why still "content and value" validation is required? – Rad4 Apr 11 '15 at 02:13
  • For MRM and DFDL parsing does validate against the model but restrictions are only checked if validation is enabled. So for example with a non-validating parse against a model it will check only if a certain field can be interpreted as an in, using Content and Value it may check the int is say between 10 and 15. – Dave Apr 15 '15 at 15:45