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

What is declarative XML? (And what's not)

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "'xml-dev@lists.xml.org'" <xml-dev@lists.xml.org>
  • Date: Sun, 31 May 2009 09:23:33 -0400

What is declarative XML? (And what's not)

Hi Folks,

Just because a document is expressed using XML does not mean it's declarative. Non-declarative, procedural logic can be expressed as readily in XML as in FORTRAN.

So, what are the distinguishing characteristics of declarative XML documents?

Below I have taken a stab at answering this question. I am interested in hearing your thoughts.  /Roger


EXAMPLE OF A DECLARATIVE XML DOCUMENT ----------------------------------------------------------
<purchases date="2009-05">
    <merchandise>
        <name>Sony HT-IS100 BRAVIA Home Theater Micro System</name>
        <cost currency="USD">299.00</cost>
    </merchandise>
    <merchandise>
        <name>ASUS Eee PC 1000HE Netbook Computer</name>
        <cost currency="USD">379.00</cost>
    </merchandise>
    <merchandise>
        <name>Sony ICD-PX720 Digital Voice Recorder</name>
        <cost currency="USD">49.00</cost>
    </merchandise>
</purchases>
----------------------------------------------------------


DISTINGUISHING CHARACTERISTICS OF DECLARATIVE XML DOCUMENTS

Characteristic #1 

The markup (elements, attributes) are nouns or noun phrases with an agreed upon definition.

   <purchases>, <merchandise>, <name>, <cost>, 
   and the "currency" attribute are all nouns.


Characteristic #2 

There are no processing semantics associated with the markup. However, processing semantics may be added *locally* by users.

    The <merchandise> element has no semantics beyond
    the dictionary meaning of the noun "merchandise."
    Users are free to layer on their own local 
    processing semantics. For example, one user may 
    store the contents of <merchandise> into a database. 
    Another user may retrieve the value of <name> and  
    display it on a screen.  


Characteristic #3 

There is a unifying theme for the data, i.e. the data falls within a single domain. 

   These values - 2009-05, Sony HT-IS100 BRAVIA Home Theater 
   Micro System, $299 USD - are all in the domain of buying 
   and selling merchandise.


Characteristic #4 

Domain-specific questions can be asked of the document. 

   For the above document you can ask: 
     - Which merchandise cost the most?
     - How many items were purchased?
     - What's the total cost of all the merchandise?
     - When was the merchandise purchased?


Characteristic #5

User-interface forms can be created to enable users to change the data. 

   For the above document you can create a form that lets users:
     - Change the purchase date
     - Add new merchandise
     - Delete merchandise
     - Modify a merchandise item 


QUESTIONS

Do you agree with this list?

Are there other characteristics you recommend adding?



EXAMPLE OF AN XML DOCUMENT THAT IS *NOT* DECLARATIVE
----------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="2.0">

    <xsl:variable name="total-cost" 
                  select="sum(/purchases/merchandise/cost)" />

</xsl:stylesheet>
----------------------------------------------------------

Let's see how well the stylesheet document satisfies the characteristics:

Characteristic #1 

The markup (elements, attributes) are nouns or noun phrases with an agreed upon definition.

   The "select" attribute is a verb.


Characteristic #2 

There are no processing semantics associated with the markup. However, processing semantics may be added *locally* by users.

    The markup has inherent processing semantics. For  
    example, <xsl:variable> *creates* a new variable.  


Characteristic #3 

There is a unifying theme for the data, i.e. the data falls within a single domain.

   The data - 2.0, total-cost, sum(/purchases/merchandise/cost) -
   is disjointed: '2.0' is in the domain of XSLT, 'total-cost'
   is in the domain of buying and selling merchandise, and
   'sum(/purchases/merchandise/cost)' is in the domain of
   XPath.


Characteristic #4 

Domain-specific questions can be asked of the document.  

   There are no domain-specific questions that can be
   reasonably asked. 


Characteristic #5 

User-interface forms can be created to enable users to change the data. 

   There are no domain-specific values that can be changed.


QUESTION

Do you agree that this stylesheet document is not a declarative XML document?


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