And of course we always joke about this document type:<!ELEMENT element ANY ><!ATTLIST element tagname NAME #REQUIRED ><!ELEMENT attribute EMPTY ><!ATTLIST attributename NAME #REQUIREDvalue CDATA #REQUIRED>If your XML CMS requires all documents to be grammar valid, then validate this.From: "Costello, Roger L." <costello@mitre.org>
Date: Friday, October 7, 2016 at 8:20 PM
To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
Subject: [xml-dev] A generic approach to XML design versus a hardcoded approach to XML designHi 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