comp.lang.ada
 help / color / mirror / Atom feed
From: Nick Roberts <nick.roberts@acm.org>
Subject: Re: DOM and SAX parsing in Ada
Date: Tue, 25 Jan 2005 15:29:40 +0000
Date: 2005-01-25T15:29:40+00:00	[thread overview]
Message-ID: <gemini.iavppg0091gj502zw.nick.roberts@acm.org> (raw)
In-Reply-To: 41F4DB6F.4090909@mailinator.com

"Alex R. Mosteo" <devnull@mailinator.com> wrote:

> Nick Roberts wrote:
> 
> > Would anyone be interested in an Ada package that parsed XML (including
> > DTDs and entities, with namespace support), but which was written with
> > an interface that is (hopefully) better suited to Ada than DOM or SAX?
> 
> I for one am interested. What kind of Ada-ish interface have you in mind?

It is really quite similar to DOM, but simplified and made more Ada-ish.

Most of the exported types are token types, whose values are references to
the object itself. Tokens are easily copied and passed around, and are
naturally implemented (privately) as access values. So, for example, a
document in memory is represented by the Document_Ref type, and elements
within a document by the Element_Ref type, and so on.

There is a Read procedure to read an XML document into memory (which can
read and use a DTD, performing full validation), and a Write procedure to
write out a document in memory (as a standalone XML document).

I have provided a full set of operations for querying a document in memory,
and a redcued set of operations which allow the construction (or extension)
of a document's structure (but not modification-in-place, reorganisation, or
deletion). I reckon this simplifies the interface (and the iplementation)
tremendously without much loss of usefulness, since the typical idiom of an
XML processing program written in Ada will be to traverse through one
structure, generating another structure as it goes.

I've not included anything like XPath; I don't think it would be appropriate
at the level of Ada programming. It would be easy enough to write a
procedure that iterated another procedure (as an access parameter) for each
node matching certain criteria.

I am including a convenience procedure to copy a node from one document to
another.

More later.

-- 
Nick Roberts



  parent reply	other threads:[~2005-01-25 15:29 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-08 23:24 DOM and SAX parsing in Ada Tim Roede
2004-11-09  0:24 ` David Botton
2004-11-09  0:56   ` David Botton
2004-11-09  8:33     ` Martin Krischik
2004-11-09 13:25       ` David Botton
2004-11-09  3:14 ` Steve
2005-01-20 12:16   ` okellogg
2005-01-21 18:09     ` Nick Roberts
2005-01-24 11:26       ` Alex R. Mosteo
2005-01-24 12:16         ` Marius Amado Alves
2005-01-24 20:17           ` Georg Bauhaus
2005-01-24 21:18             ` Pascal Obry
2005-01-24 19:02         ` Marc A. Criley
2005-01-25  9:50           ` Alex R. Mosteo
2005-01-25 15:29         ` Nick Roberts [this message]
2005-01-25 18:21           ` Marc A. Criley
2005-01-26  5:39             ` Nick Roberts
2005-01-26  7:37               ` Martin Krischik
2005-01-26 12:24               ` Jeff C
2005-01-26 16:16                 ` Nick Roberts
2005-01-26 16:46                   ` Georg Bauhaus
2005-01-27 19:45                     ` Nick Roberts
2005-01-26 22:14                   ` Brian May
2005-01-27  9:28                     ` Martin Krischik
2005-01-27 19:55                     ` Nick Roberts
2005-01-28 10:05                       ` Stephen Leake
2005-01-26 23:48                   ` Stephen Leake
2005-01-27 20:05                     ` Nick Roberts
2005-01-27 20:57                       ` Marc A. Criley
2005-01-27 22:11                         ` Nick Roberts
2005-01-27 22:24                           ` Pascal Obry
2005-01-28  0:29                             ` Nick Roberts
2005-01-28  7:22                               ` Pascal Obry
2005-01-28  2:56                           ` Steve
2005-01-28 13:32                             ` Georg Bauhaus
2005-01-28 15:25                             ` Nick Roberts
2005-01-28 10:23                           ` Stephen Leake
2005-01-29 11:58                             ` Simon Wright
2005-01-28 13:47                           ` Georg Bauhaus
2005-01-29 17:08                             ` Nick Roberts
2005-01-31 14:24                               ` Marc A. Criley
2005-01-28 13:54                           ` Georg Bauhaus
2005-01-29 11:54                           ` Simon Wright
2005-01-29 16:54                             ` Nick Roberts
2005-01-28 10:17                       ` Stephen Leake
2005-01-27  4:11                   ` Jeff C
2005-01-27 19:05                     ` Pascal Obry
2005-01-27 20:15                     ` Nick Roberts
2005-01-27 22:28                       ` Pascal Obry
2005-01-28  0:30                         ` Nick Roberts
2005-01-26 14:12               ` Marc A. Criley
2005-01-27  3:59                 ` Steve
2005-01-27  9:32                   ` Martin Krischik
2005-01-27 19:27                     ` Pascal Obry
2005-01-28  3:17                       ` Steve
2005-01-28  7:14                         ` Pascal Obry
2005-01-28 10:00                         ` Stephen Leake
2005-01-28  7:47                       ` Martin Krischik
2005-01-28  9:57                       ` Stephen Leake
2005-01-28 16:36                         ` Pascal Obry
2021-11-22 13:01   ` James Hitch
2021-11-22 13:31     ` Simon Wright
2021-11-22 13:54       ` James Hitch
  -- strict thread matches above, loose matches on Subject: below --
2005-01-25  0:22 amado.alves
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox