Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] What's an elegant way to write symbolic entities

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Tatu Saloranta <cowtowncoder AT yahoo.com>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>, davecb AT spamcop.net
  • Subject: Re: [XOM-interest] What's an elegant way to write symbolic entities
  • Date: Mon, 10 Jan 2011 09:48:01 -0800 (PST)



--- On Sun, 1/9/11, David Collier-Brown <davec-b AT rogers.com> wrote:

> From: David Collier-Brown <davec-b AT rogers.com>
> Subject: Re: [XOM-interest] What's an elegant way to write symbolic entities
> To: "Elliotte Rusty Harold" <elharo AT ibiblio.org>
> Cc: "XOM API for Processing XML with Java"
> <xom-interest AT lists.ibiblio.org>, davecb AT spamcop.net
> Date: Sunday, January 9, 2011, 5:36 PM
> Elliotte Rusty Harold wrote:
> > On Sun, Jan 9, 2011 at 11:44 AM, David Collier-Brown
> <davec-b AT rogers.com>
> wrote:
> >
> >   
> >>  Is there a simple, straightforward and
> perhaps even elegant way
> >> to produce output containing symbolic entities?
> >>     
> >
> > No, there isn't.
> >
> > Writing an editor is the one major use case that is
> explicitly outside
> > the goals of XOM (and implicitly outside the goals of
> every other
> > major XML API).
> >
> > If you're going to write an editor you probably need to start by
> > writing your own parser and libraries, because the usual ones just
> > don't support this use case.
> >
> >   
> Ok, thanks: I'm actually producing input data for an editor, but that
> looks as if it's effectively the same thing.

I would soften Elliotte's suggestion by noting that while handling of
DTD-provided entities (or access to them) is generally well supported, some
libraries provide more access than others.
So I would suggest trying to use existing an existing parser (and generator)
as base. Woodstox does provide more access to "exotic" parts than many
others, for example, especially via stax2 extension API.
It also reports accurate location information, and is used by tools like
editors (based on feature requests).

It may be necessary to have a customized version, but writing a parser is a
rather non-trivial task, and part of the reason for lack of access to DTD
aspects has to do with complexity of DTD handling itself.
And even if you do need to implement a higher-level abstraction (like tree
model that XOM et al provide) you would save quite a bit of work.

-+ Tatu +-








Archive powered by MHonArc 2.6.24.

Top of Page