1

It might sound like a silly question, but for people outside the software industry, it is not so easy to figure out:

Once I have created a data standard with my XML schema, how do I control the correctness of the data (for instance XML files). Should I use particular packages in some specific programming language to discriminate compliant files from non-compliant? Or do I need to translate my schema in something else, for instance JSON schema ?

kjhughes
  • 106,133
  • 27
  • 181
  • 240
M4hd1
  • 133
  • 8

1 Answers1

1

The process of determining whether an XML document complies with an XML schema is called validation. There are open source and commercial validating parsers which will report whether and how an XML document violates the grammar and vocabulary specified in an XML schema.

You do not need to translate your XSD. You do not need to write additional software, unless you wish to enforce additional constraints not expressed in your XSD.

An XSD cannot directly validate JSON, however see Validate JSON against XML Schema (XSD).

kjhughes
  • 106,133
  • 27
  • 181
  • 240
  • Thank you @kjhughes for the answer. Do you have maybe more insights on pratical intergration of XML schema in webapp for instance. Because I have to admit that now I have my xsd file, working fine with my xml development IDE, but I don't know how to proceed in real life. – M4hd1 Aug 30 '18 at 14:46
  • It's a design decision whether to validate each time an application or service parses an XML document. Whether the incremental increase in time is worth the improved safety and diagnostics depends upon requirements and the reliability of the source of the XML document. – kjhughes Aug 30 '18 at 15:14