[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
What is the equivalent functional programming function(s) forhopping from element to element via XML "IDREF" references (or XSD "base"references)
- 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
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 & 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]