I need to tighten validation on a moderately complex schema (SAML Metadata) comprising approx. 10 XSD files giving 1000 lines of schema definition. The validation should primarily require optional elements and attributes, restrict node and attribute contents to certain values, issue warnings on recommended or deprecated elements and attributes, and refuse anything that is not part of the schema, including stuff in extension elements of the original schema. What is the best approach for this? Plain XSD, XSD + assertion, Schematron, or using some language and parse the document?
Asked
Active
Viewed 2,208 times
3
-
Do you support XSD 1.1 on your platform? If not, would your solution allow for an XSLT processing step (which is Schematron basically)? Do you have access to a business rules engine? Ideally you should keep validation logic separate from processing logic... Options galore, dependencies, too, you would have to augment with constraints you have... – Petru Gardea Jan 27 '14 at 19:31
-
I'll keep my previous comment for now... I've checked your website, based on what I can see there, your best bet seems to be XSD 1.0 + Schematron. In my opinion, Schematron should be used on top of XSD (AND instead of OR). – Petru Gardea Jan 27 '14 at 20:20
-
Calling Xerces to use XSD 1.1 validation would not be a major extra effort, but basically the target environment is java-free. I do not have a lot of experience with XSLT, only remember it as a bit cumbersome to express yourself. Processing is not a topic; I need just additional validation with proper error and warning messages. Existing validation using the original OASIS SAML XSD is a must and already implemented. My main priority would be to be able to express additional restrictions and warnings in a readable and simple way. – rhoerbe Jan 29 '14 at 13:56
-
One more requirement: I do not want to re-implement the whole schema, but only add a few rules pertaining the additional rules. – rhoerbe Jan 29 '14 at 14:04
-
2Then your best bet is Schematron; its constraints can be expressed separate from the XSD itself, so you don't have to worry about original XSDs... – Petru Gardea Jan 29 '14 at 14:52