The Mercury Project
Re: [mercury-users] XML / DOM

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 - 12:52:00 EST


On Tue, Dec 19, 2000 at 12:26:54PM EST, Richard A. O'Keefe wrote:
> If I have only
> values, first I have to unify subtrees to search for matches (which
> may be arbitarily expensive),
>
> Wrong.
>
> and even then I have no way of knowing
> if this is the *real* parent,
>
> Wrong.
>
> 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).
>
> and Wrong again.
>

Well, at least I got an unequivocal response! ;-)

So are you suggesting that nodes be identified by contatining a `thingy'
that uniquely identifies them? eg

:- type element
        ---> element(
                    id :: thingy,
                    name :: qName,
                    attrs :: [(qName - string)],
                    kids :: [content]
                ).

:- type content
        ---> element(element)
        ; data(string)
        ; comment(string)
        ; pi(string, string)
                        % should probably be:
                        % pi(qName, string)
                        % but the XML Names rec is broken
        .

Without having thought long and hard about it, although this gives an
O(N) way of locating the parent, an ancestor, or sibling, I don't see
how to get any of these (in particular the first or last) in O(1) which
you can using pointers in C/C++.

If you could either provide a sketch of how this is done, or a link
to your paper, then that would be very useful.

> Without node identity, it would be almost impossible to implement
> XPath and XSLT efficiently.
>
> I have no idea about implementing XSLT; I've tried to read the spec and
> was so disgusted that I have trouble thinking about it. Yet another typical
> W3C spec with oodles of syntax, but only warm fuzzies where the hard parts
> of semantics are concerned.

Indeed, the spec is light on semantics, however XSLT is nonetheless
quite a nice *declarative* way of transforming documents.

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