I have XML documents that are using a subset, e.g. 90% of all the elements available in some official, industry schema (cannot be modified). The business requirements for the project excludes about, say, 100 fields from this schema. What is the best way to validate these XML documents to make sure they do not contain any of the 100 "banished" fields/xpaths?
One option (not preferable) would be to create a custom schema that is a subset of the original industry schema without the 100 fields and validate the XML documents against that trimmed down schema. Creating/maintaining a separate schema was ruled out, however, as it would be too complex and not maintainable.
I am then interested in the approach where these are given: 1) XML documents 2) schema 3) list of excluded fields... and a technical solution is needed to validate the XML documents against 2 + 3. Ideally the solution is efficient and maintainable.
[I am thinking some XSLT perhaps that would somehow loop through a list of 100 Xpath expressions (perhaps maintained in an external configuration file) and check for the presence of banished elements, if that makes any sense...]
I would appreciate detailed guidance / insights from a few experts on this. A code snipped to illustrate would be great. Thanks for your expertise.