Next in thread → Next in month →

Re: [xml-dev] A generic approach to XML design versus a hardcoded approach to XML design

From
Rick Jelliffe <>
To
Eliot Kimber <>
Date
2016-10-10T02:44:34Z
ID
<CADUdYQXM-GdmYu4dP8s765yXn4gEo+W1xb0_gmto88=>
Thread
Re: [xml-dev] A generic approach to XML design versus a hardcoded approach to XML design
Yes, I actually have had to use something like this.  It was pre-XML, when a document *had* to have a DTD  but I needed to get arbitrary information from A to B without being able to actively maintain the intermediate format.  Felt shame, cold, fear.   Now in XML we just omit the DOCTYPE:  X!

It would have been
<!ELEMENT element (atribute*, element*) >

Regards
Rick

On Sat, Oct 8, 2016 at 3:59 PM, Eliot Kimber <[email protected]> wrote:
And of course we always joke about this document type:

<!ELEMENT element ANY >
<!ATTLIST element tagname NAME #REQUIRED >

<!ELEMENT attribute EMPTY >
<!ATTLIST attribute
   name NAME #REQUIRED
   value CDATA #REQUIRED
>

If your XML CMS requires all documents to be grammar valid, then validate this.

Cheers,

Eliot
--
Eliot Kimber
 


From: "Costello, Roger L." <[email protected]>
Date: Friday, October 7, 2016 at 8:20 PM
To: "[email protected]" <[email protected]>
Subject: [xml-dev] A generic approach to XML design versus a hardcoded approach to XML design

Hi Folks,

Compare these two designs for modeling an event occurring on March 21, 2012:

<graduation date="2012-03-21"/>

<event type="graduation" date="2012-03-21"/>

The second design uses a “generic approach to XML design.” The <event> element denotes any arbitrary (generic) event. The attribute value identifies the specific event.

The first design uses a “hardcoded approach to XML design.” The <graduation> element hardcodes the event.

In the generic approach the semantics is in the attribute value. In the hardcoded approach the semantics is in the element name.

The generic approach, when coupled with Schematron, enables the creation of powerful (flexible, extensible) data models. Other events can be readily created without any modification to an XML Schema. For example:

                <event type="Autumnal Equinox" date="2017-09-22"/>

Here’s another event (note the rich semantics):

                <event type="U.S. presidential election" date="2016-11-08"/>

Regrettably, many people are not taking advantage of generic XML designs. Here’s what Rick Jelliffe says:

Mainstream XML technology definitely disfavors generic approaches:
               to move to generic approaches where the specific semantics is in
               attributes *and* retaining validation requires moving to RELAX NG
               or Schematron in which attributes are first-class citizens (rather than
               DTDs or XSD where all patterns/types are keyed by element context
               only.) 

Comments?

Thanks Rick for raising this important issue.

/Roger


Next in thread → Next in month →