开发者

Validation Layer with interdependency checks

Existing backend services will be opened for more clients (adding a Web Service Layer to the Web-Frontend client).

Currently, XML Schema is used for validati开发者_运维技巧on of DTOs, but since the frontend is out of our control, we will have to move extended tests (eg. interdependency tests) from the frontend layer to a new "validation layer".

Now our question is if there exist a common pattern for this, eg. something similar to using RELAX NG or a rule engine? The requirement is to be able to check datatypes (we would stay with XML Schema here) and interdependencies, but these interdependencies can get quite complicated, ie. they might involve checks on data which is not available in the input data (but in some external system).

So we are looking for a patterns as well as a framework which makes it easy to implements the patterns.


Schematron is the schema language to look at (used as a layer on top of your XSD probably).

Schematron is based around constraints expressed using XPath, which in most cases is powerful enough to express what is needed. Since XPath can be extended with user-defined functions, there is scope to be able to carry out potentially any validation by e.g. comparing data from external databases etc.

(If you are drawing on data outside your document for validation purposes a nice approach is to expose that external data as XML - perhaps available in a RESTy fashion - so the validation constraints can be expressed entirely in XML terms within your Schematron schema.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜