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"?>
        <title>The Origin of Wealth</title>
        <author>Eric D. Beinhocker</author>
        <publisher>Harvard Business School Press</publisher>
        <cost currency="USD">29.95</cost>
        <title>DOM Scripting</title>
        <author>Jeremy Keith</author>
        <publisher>friends of ed</publisher>
        <cost currency="USD">34.99</cost>

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.


[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