Hi,
I need to come up with some kind of rules engine, where I can specify validation rules for specific xml files. Then the rules are read in and asserted against the xml.
Whats the best way? Is it XPath, or XQuery, or XSL, or XSD even? Or maybe even XMLUnit?
I'll need to do stuff like detect when certain attibutes are different from similar nodes, e.g.:
<root>
<customers>
<customer name="Fred">
<contact-details email="[email protected]">
</customer>
<customer name="Barney">
<contact-details email="[email protected]">
</customer>
<customer name="Fred">
<contact-details email="[email protected]">
</customer>
</customers>
</root>
So it would detect that the email addresses above are different, as one rule. Also needs to validate the data in the xml against external reference data, e.g. postcode lookups, etc.
Any suggestions as to what I should use to easily specify rules, that runs pretty quick? The XML and external data is moderately large - can be several MB per xml.
Some of the rules would be simple, and can be done in XPath - check fields are a certain length, or check certain odes have certain attributes populated - XSD is suitable here. But not for checking against external data, or doing the above. Is XQuery what I want?
Thanks if you can help.
-Justin