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]
3 Common Patterns in XML Processing

Hi Folks,

I wrote a short article titled:

   3 Common Patterns in XML Processing


Here is the start of the article:

---------------------------
XML Documents Contain Lists
---------------------------

Most XML documents contain lists of elements. For example, this document contains a list of <book> elements:

<?xml version="1.0" encoding="UTF-8"?>
<books>
    <book>
        <title>The Origin of Wealth</title>
        <author>Eric D. Beinhocker</author>
        <date>2006</date>
        <ISBN>1-57851-777-X</ISBN>
        <publisher>Harvard Business School Press</publisher>
        <cost currency="USD">29.95</cost>
    </book>
    <book>
        <title>DOM Scripting</title>
        <author>Jeremy Keith</author>
        <date>2005</date>
        <ISBN>1-59059-533-5</ISBN>
        <publisher>friends of ed</publisher>
        <cost currency="USD">34.99</cost>
    </book>
    ...
</books>

Consequently, processing XML documents typically involves processing lists.


---------------------------------
3 Common Ways of Processing Lists
---------------------------------

There are 3 things that are commonly done to lists:

1. Map: a new list is created with the same length as the original, and each item in the new list is the result of doing one piece of work on the corresponding item in the original list.

2. Filter: select pieces of a list-walk through a list, selecting those that satisfy a criterion.

3. Fold: reduce a list to a single value-do something to every element of a list, updating an accumulator along the way, and returning the accumulator when done.

More ... http://www.xfront.com/3-Common-Patterns-in-XML-Processing.pdf

Comments welcome.

/Roger


[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