# Which is more declarative? More XMLish?

• From: "Costello, Roger L." <costello@mitre.org>
• To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
• Date: Sat, 2 Dec 2017 14:26:36 +0000

 Hi Folks, XML documents oftentimes contain a set of things – a set of books, a set of people, a set of transactions, etc. Typically, a set isn’t allowed to contain just anything, the set must satisfy some constraints. Constraints can be expressed in different ways. Perhaps one way is better than another? Perhaps one is more declarative, the other more imperative? Perhaps one is XMLish, the other not? Example: Here is an XML document containing a set (of positive even numbers):     0     2     4     6     …   Here are two ways to specify the set:   1. Defining properties: identify the properties that each member of the set must have. In this example, each number must have these 2 properties:   Positivity Evenness   The two properties can be expressed in Schematron:                    Property: to be a member of the set, the number must be positive.                      Property: to be a member of the set, the number must be even.       2. Generate set members: specify how to generate the members of the set. The set of positive even numbers can be generated this way:   0 is an element of the set. If x is an element of the set, then x+2 is an element of the set. (Alternatively: if x is an element of the set, then x-2 is an element of the set) Nothing else belongs to the set.   Generating the set’s members can be expressed in Schematron:                    0 is in the set.                      If i is in the set, then i-2 is in the set           Recap: We’ve seen two ways to specify (constrain) a set: (a) State a property (or properties) that an object must have to qualify as a member of the set. (b) Define a set of rules which generate its members.   Which way is better? Which is preferred? Which is more declarative? Which is more XMLish?   /Roger

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

### PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
 RSS 2.0 Atom 0.3 Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.