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

What is the equivalent functional programming function(s) forhopping fro

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Thu, 7 Apr 2011 09:56:27 -0400

What is the equivalent functional programming function(s) forhopping fro
Hi Folks,

This XML document has an IDREF attribute that references an ID value:

--------------------------------------------------------------
<?xml version="1.0"?>
<Library>
    <BookCatalogue>
        <Book id="isbn-94303-12021-43892">
                <Title>My Life and Times</Title>
                <Author>Paul McCartney</Author>
                <Date>1998</Date>
                <Publisher>McMillan Publishing</Publisher>
        </Book>
        <Book id="isbn-0-440-34319-4">
                <Title>Illusions The Adventures of a Reluctant Messiah</Title>
                <Author>Richard Bach</Author>
                <Date>1977</Date>
                <Publisher>Dell Publishing Co.</Publisher>
        </Book>
        <Book id="isbn-0-06-064831-7">
                <Title>The First and Last Freedom</Title>
                <Author>J. Krishnamurti</Author>
                <Date>1954</Date>
                <Publisher>Harper &amp; Row</Publisher>
        </Book>
    </BookCatalogue>
    <GuestAuthors>
        <GuestAuthor>
            <BookSigning idref="isbn-0-440-34319-4"></BookSigning>
        </GuestAuthor>
    </GuestAuthors>
</Library>
--------------------------------------------------------------

If I start at <BookSigning> then I want to hop to the <Book> that is referenced by the "idref" attribute.


An analogous situation occurs in XML Schema. This XML Schema document has a simpleType that references another simpleType, using the "base" attribute:

--------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 

    <xsd:simpleType name= "EarthSurfaceElevation">
        <xsd:restriction base="xsd:integer">
            <xsd:minInclusive value="-1290"/>
            <xsd:maxInclusive value="29035"/>
        </xsd:restriction>
    </xsd:simpleType>
    
    <xsd:simpleType name= "BostonAreaSurfaceElevation">
        <xsd:restriction base="EarthSurfaceElevation">
            <xsd:minInclusive value="0"/>
            <xsd:maxInclusive value="120"/>
        </xsd:restriction>
    </xsd:simpleType>
    
</xsd:schema>
--------------------------------------------------------------

If I start at the BostonAreaSurfaceElevation <xsd:simpleType> then I want to hop to the <xsd:simpleType> that is referenced by the "base" attribute.

Those are just two examples. Many others could be provided for, not only XML and XML Schema, but for XSLT and others.

The examples illustrate a recurring pattern: start at one element and hop, hop, hop to each element in the chain of references.

How do I cast this recurring pattern into a functional programming mindset? For example, how would it be viewed from the Haskell mindset?

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