9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: rog@vitanuova.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] OT: small xml parser found!
Date: Thu, 19 Feb 2004 17:15:44 +0000	[thread overview]
Message-ID: <fbb4f5bebcf5822a894afceb2466f92d@vitanuova.com> (raw)
In-Reply-To: <1077206087.1790.18.camel@pc118>

> >> Why isn't Expat suitable?
> >
> > callbacks are horrible.
>
> Reasons?.
>
> Callback-(handler)s are interrupt-(handler)s
> [...]

can i just add this reference:

http://www.codepedia.com/wiki/display.aspx?WikiID=1&pagename=thunks

as an example of a really nasty way (note the machine dependent bit)
of getting around some of the limitations of a callback-based system.

if i was going to use expat, i'd wrap it up with the plan 9 threads
library, so that constructs would arrive on a channel, then at
least things would be marginally more bearable.

but even then, you'd probably want to put a function call interface
around the channel, as otherwise it's really quite awkward
skipping subtrees you don't want to know about.

i wasn't too dissatisfied with the xml(2) interface in inferno,
which looks something like (limbo syntax, i'm afraid):

	open: fn(fd: ref Sys->FD): ref Parser;
	Parser: adt {
		next: fn(p: self ref Parser): ref Item;
		down: fn(p: self ref Parser);
		up: fn(p: self ref Parser);
	};

next() gives you the next item at the current level (nil if we're
at the end of the enclosing block); down() delves into the most recently
returned element, and up() ascends a level.

one advantage of doing it this way is that potentially the parser
can drive how the parsing takes place; the above interface
takes advantage of that by allowing random access into
the XML (you can go back to a place you've previously marked).



  parent reply	other threads:[~2004-02-19 17:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-17 13:50 steve-simon
2004-02-18 18:17 ` Roger Flores
2004-02-18 20:43   ` rog
2004-02-18 20:42     ` David Tolpin
2004-02-19 15:29       ` rog
2004-02-19 15:27         ` Gorka Guardiola Múzquiz
2004-02-19 15:31           ` boyd, rounin
2004-02-19 16:14             ` Rob Pike
2004-02-19 16:16             ` Rob Pike
2004-02-19 16:18               ` David Tolpin
2004-02-19 16:20               ` boyd, rounin
2004-02-19 15:54           ` John Murdie
2004-02-19 16:14             ` C H Forsyth
2004-02-19 16:24               ` John Murdie
2004-02-19 16:17             ` David Tolpin
2004-02-20  2:36               ` boyd, rounin
2004-02-19 17:15             ` rog [this message]
2004-02-19 17:20               ` David Tolpin
2004-02-19 17:31                 ` rog
2004-02-19 17:30                   ` David Tolpin
2004-02-19 17:45                     ` rog
2004-02-19 17:39                   ` C H Forsyth
2004-02-19 15:27         ` David Tolpin
2004-02-19 10:28     ` Roger Flores
2004-02-19  9:59 plan9fans
2004-02-19 10:13 ` David Tolpin
2004-02-19 11:04 ` Dave Lukes
2004-02-19 11:41   ` matt
2004-02-19 12:36     ` Dave Lukes
2004-02-19 13:45       ` C H Forsyth
2004-02-20  8:22         ` Martin C.Atkins
2004-02-19 10:31 plan9fans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fbb4f5bebcf5822a894afceb2466f92d@vitanuova.com \
    --to=rog@vitanuova.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).