|
Home
News
Information
Overview
Features
Documentation
Papers
 Developers
 Events
 Reports
Mailing Lists
Developers
Users
Search
Download
Current Release
Snapshot
Old Releases
Related
Applications
MCORBA
Contributing Code
Contact
Search
|
Subject: Re: [mercury-users] XML / DOM
From: Thomas Conway (conway@cs.mu.OZ.AU)
Date: Tue Dec 19 2000 - 11:04:54 EST
On Tue, Dec 19, 2000 at 10:21:38AM EST, Richard A. O'Keefe wrote:
> Not me, but I *have* studied the level 1 and level 2 DOM specifications
> in detail. It's hard to think of anything that would be less suitable
> for Mercury. Come to think of it, it's hard to think of anything less
> well designed for doing anything with XML in any language than the DOM.
>
> When manipulating SGML or XML documents in languages like Erlang,
> Prolog, Mercury, or Haskell it is normal to treat them as tree *values*.
I agree with you that a *real* tree is much nicer to deal with than
an indirect representation, however I would note that if you're dealing
with beasts such as XPath, then it is rather inconvenient that the
nodes in the document tree don't have identity. Being able to deal
nicely with IDREF[S] and so forth using `pointers' is rather useful.
What would be nice is to have your cake and eat it. ML lets you (at
some cost, which you might very well argue is not worth paying) by
letting you have references to values. Like it or not, pointers/identity
lets you perform some operations MUCH more efficiently. For example
consider the case where I want the parent of a node. If I have only
values, first I have to unify subtrees to search for matches (which
may be arbitarily expensive), and even then I have no way of knowing
if this is the *real* parent, or if there is more than one possible
parent (unless I return all possible parents, but then we have the
same problem all over again).
Without node identity, it would be almost impossible to implement
XPath and XSLT efficiently.
--
Thomas Conway Mercurian )O+
<conway@cs.mu.oz.au> Every sword has two edges.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users@cs.mu.oz.au
administrative address: owner-mercury-users@cs.mu.oz.au
unsubscribe: Address: mercury-users-request@cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request@cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
This mail archive was generated by hypermail 2b25 on Sun Dec 31 2000 - 00:40:05 EST.
|