[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: A generic approach to XML design versus a hardcodedapproac

  • From: Rick Jelliffe <rjelliffe@allette.com.au>
  • To: Eliot Kimber <ekimber@contrext.com>
  • Date: Mon, 10 Oct 2016 13:44:34 +1100

Re:  A generic approach to XML design versus a hardcodedapproac
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 <ekimber@contrext.com> 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." <costello@m...>
Date: Friday, October 7, 2016 at 8:20 PM
To: "xml-dev@l..." <xml-dev@l...>
Subject: 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




[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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

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.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.