I agree with Dave’s comment that XRules is suitable for the .NET platform because there is only a .NET implementation right now. However, in terms of speed, I would argue that XRules is faster than Schematron. I haven’t done any testing, but I’m basing my opinion on the following:
- Schematron also loads the whole XML document into memory (that’s necessary to implement XSLT transformations, which are used behind the scenes)
- XRules doesn’t do any XSLT transformations and therefore escapes these resource-intensive operations. On the other hand, Schematron performs two XSLT transformations for each validation.
- XRules provides syntax to easily select the nodes and context in which XPath expressions work, while in Schamtron all expressions are global. Therefore, you’ll notice that XRules expressions are consistently smaller and easier to write and read than Scheamtron expressions. And, expectedly, simpler expressions run faster.
And, other than performance, XRules provides many features that are impossible to implement in Schematron due to it’s dependency on XSLT. Obviously, dynamic validation and dynamic node updates are the most obvious, but also XRules Properties, simpler expressions, and more built-in rules.
Regards,
Waleed
-----Original Message-----
From: xrules@yahoogroups.com
[mailto:xrules@yahoogroups.com] On Behalf Of David
Carver
Sent: Sunday, March 25, 2007 7:01
AM
To: xrules@yahoogroups.com
Subject: Re: [xrules] Re: Using
Xrules, schema and XML to maintain CRUD for an application
Ravi wrote:
> Waleed,
>
> Thanks for your response..
>
> Our backend parameter data is exposed as XML documents for other
> groups to build a CRUD application. These groups use thick or thin
> clients. So, we have multiple front ends for the one backend.
> My goal is to encapsualte all data validation rules in one place,
> not
> have them spread all over.
>
> Examples of business rules i am talking about here are:
> 1. Product type:
> 2. prouct days
>
> -Valid values for prodcut type are A, B, C
> -Valid values for prodcut days are 01, 04, 10, 07
> -Cross validate type and days. If type =A, days must be less than
> 10. If type = B, days must be greater than 02.
>
> If I can encapsulate these types of rules in a structured document
> (such as xrules doc), then all my front end developers can build
> their applications(
> capture data from users and will send the xml data doc back to the
> backend.
>
> With this approach, If I want to add any new parameters, it will be
> very dynamic. If I want to change a rule, its easier to implement. I
> just have to release a new xrules doc every time there is a new
> release of the software.
>
XRules would be my first choice for a Windows platform, with small data
sets. Reason I say small data sets is that it loads items into a DOM,
which means it's in memory to do the validation.
An alternative that you could explore as well, would be ISO Schematron.
Which isn't tied to .NET. XRules does have the advanatge in being able
to dynamically update the DOM with new values, where as Schematron is
only doing validations and no dynamic updates.
One other advantage for Schematron is that you can use XPath 2.0.
XRules would need to be updated to use the SAXON .NET framework in order
to get access to the XPath 2.0 support.
Just some things to think about.
Dave