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

XML Literalist

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Sun, 20 Mar 2011 09:43:00 -0400

XML Literalist
Hi Folks,

[Definition] Literalist: A person who adheres to the literal representation of a statement or law; a person who translates text literally.


The XML specification defines an attribute as follows:

  Attributes are used to associate name-value pairs with elements.

The specification states where attributes are to be positioned:

    Attribute specifications MUST NOT appear outside of start-tags 
    and empty-element tags

And it specifies the format of attributes:

    name = delimiter value delimiter


The specification says that elements may have attributes:

    Each element ... may have a set of attribute specifications

The specification says that elements are boundaries:

    Each XML document contains one or more elements, the boundaries of which 
    are either delimited by start-tags and end-tags, or, for empty elements, 
    by an empty-element tag.

It defines what occurs between the start-tag and end-tag boundaries:

    The text between the start-tag and end-tag is called the element's content


XML Literalist Axioms:

1.	Attributes are name-value pairs
2.	Elements are boundaries for the content between the start-tag and end-tag
3.	Aside from (1) and (2), no further meaning is ascribed to attributes or elements.

Thus, attributes can be used wherever name-value pairs are desired and elements can be used wherever boundaries are desired. 


XML literalism is freeing. XML literalism makes XML usage objective. Here's why:

XML literalism is freeing:

-	You make decisions on whether to use an element or attribute based on technical reasons. You are not restricted to making decisions based on vague pseudo-semantic reasons. Here's an example of making a decision to use attributes based on technical reasons: Andrew Welch states that when doing SAX processing of XML documents there are technical reasons for using attributes:

> If you are sax parsing and have to switch processing based on some value, then > it's far easier to do that if it's an attribute than a child element.  For 
> example:
>
> <product type="A" name="blah">
>   <stuff/>
>
> vs
>
> <product>
>   <name>blah</name>
>   <type>A</type>
>   <stuff/>
> 
> In the former case you can easily process <product> based on its type attribute > at the time <product> is reported.
> 
> In the latter case, you have to push the events onto a stack, or recursive peek > ahead until you discover the type.


XML literalism makes XML usage objective:

A non-Literalist will say things like "attribute values provide metadata". What does that mean? What is metadata? One man's metadata is another man's data. Metadata is vague and prone to much misinterpretation. For instance, are these attributes providing metadata:

<Book category="fiction" inStock="true">
    ...
</Book>

Non-Literalists will spend countless hours debating whether category and inStock are providing metadata.

An XML Literalist says that an attribute is a name-value pair. Period. No other semantics are ascribed to attributes. Thus, there are no discussions on whether category and inStock provide metadata. Instead, a Literalist shifts the discussion to technical issues such as:

-	Are we going to use SAX to process the <Book>?
-	Will descendants of <Book> need to make validation decisions based on category and inStock? (If yes, better make them attributes and declare them inheritable)

Comments?

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