OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
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">

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)



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS