XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
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]
Adding a layer of extensibility to XML … adding a level of indirection

Hi Folks,

Yesterday Michael Kay posted [1] a fascinating message. I’d like to summarize what I learned from reading his post. [Michael, please correct any mistakes in my summary.] At the end of this message I have two questions.

Consider this XML document containing data about a book:

<Book>
    <Title>Siddhartha</Title>
    <Author>Hermann Hesse</Author>
</Book>

 

We have direct access to the data by simply navigating to an appropriate element and then “peek inside” the element. For example, we can access the data “Siddhartha” by navigating to the Title element and then peek inside the element.

XML is, of course, extensible so we can extend the XML vocabulary:

<Book>
    <Title>Siddhartha</Title>
    <Author>Hermann Hesse</Author>
    <Date>1951</Date>
</Book>

 

To recap, the document is extensible with direct access.

Sometimes it is not easy to extend an XML vocabulary in a timely fashion. If the XML vocabulary is specified by an XML Schema, and changes to the XML Schema is under the control of a slow-moving organization, then timely extensions to the XML vocabulary may be difficult. To deal with this we modify the design by turning the tags into data:

<Book>
    <NameValuePair>
        <Name>Title</Name>
        <Value>Siddhartha</Value>
    </NameValuePair>
    <NameValuePair>
        <Name>Author</Name>
        <Value>Hermann Hesse</Value>
    </NameValuePair>
</Book>

 

Accessing data now involves a level of indirection. For example, to access the data “Siddhartha” requires finding the NameValuePair with the Name element containing “Title” and then peeking inside the Value element.

The document may be extended in the normal XML fashion by adding more NameValuePair elements, but we can also add another layer of extensibility by adding new names:

<Book>
    <NameValuePair>
        <Name>Title</Name>
        <Value>Siddhartha</Value>
    </NameValuePair>
    <NameValuePair>
        <Name>Author</Name>
        <Value>Hermann Hesse</Value>
    </NameValuePair>
    <NameValuePair>
        <Name>Date</Name>
        <Value>1951</Value>
    </NameValuePair>
</Book>

 

To recap, the document has two layers of extensibility and a level of indirection.

“All problems in computer science can be solved by another level of indirection.”


Question: Is it possible to add another level of indirection? Is it possible to add another layer of extensibility?

[1] http://lists.xml.org/archives/xml-dev/202111/msg00088.html

 



[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