Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing vs Validation

What is the difference between validation and parsing?

I know parsing check file structure (grammar), so may be checked as OK in parsing function, but may be WRONG in validation process because there is no attr value like "pink"? Am I right?

like image 556
apocalypse Avatar asked Sep 20 '26 17:09

apocalypse


2 Answers

Parsing in xml terms is building a document tree from the xml data

Validation is checking the content of that tree against a schema

So if you had

<Document>Me.txt<\Document>

It could be parsed because it has a root node and all open and close tags match up etc

If you validated against a schema which said the root node was Form though it would be invalid.

like image 59
Tony Hopkinson Avatar answered Sep 23 '26 06:09

Tony Hopkinson


Parsing checks that the input conforms to the rules in the XML specification, for example that every start tag has a matching end tag.

Validation checks that the input conforms to the rules of a specific XML vocabulary, for example that a table contains exactly one thead and one tbody.

like image 23
Michael Kay Avatar answered Sep 23 '26 07:09

Michael Kay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!