commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [Digester] Supporting mixed content
Date Sat, 05 Jan 2002 19:02:24 GMT
On Sat, 5 Jan 2002, robert burrell donkin wrote:

> Date: Sat, 5 Jan 2002 13:50:57 +0000
> From: robert burrell donkin <robertdonkin@mac.com>
> Reply-To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> Subject: Re: [Digester] Supporting mixed content
>
> hi scott
>
> i'm always pretty reluctant about changes to the basic Rule interface.
>

I share this reluctance.  The kinds of documents that Digester does best
at tend to be either all-attributes or all-body-content, and I don't want
to lose the simplicity that's present for those kinds of cases.

In general, I think of Digester as a nice wrapper around *SAX* parsing,
not around DOM manipulation, and it is best used when you are using
pattern matching techniques to grab out what you want and ignoring the
rest.  The use case Scott describes might be easier to deal with using
something like DOM4J or JDOM.

> i think that there might be some other ways around this problem (but i'll
> need some thinking time) so maybe it'd be a good idea to hold off changing
> the interface for a little while.
>
> - robert
>

Craig


> On Friday, January 4, 2002, at 01:37 AM, Scott Sanders wrote:
>
> > Hi all,
> >
> > I am trying to use Digester in a situation where some elements have
> > mixed content.  For example:
> >
> > <tag name="text">Beginning effective <tag
> > name="variableRef">EffectiveDate</tag>, the new policy will be in
> > effect.</tag>
> >
> > So, currently Digester just appends the characters() method to the body
> > text and then uses it at the endElement() method.  The problem is that I
> > need the "Beginning effective " and the ", the new policy..." are
> > actually two specifically different calls to some method, like
> > addNode().  I know it sounds a little like DOM, but that is what I need
> > at the moment.
> >
> > So, how do I accomplish this?  I propose changing the characters()
> > method to call rules bodyText() method.  To prevent breakage, then I
> > need the default Rule class to append these together and then use it.
> >
> > To access this functionality, a match rule would be something like
> > "tag/text()" (ala Xpath)
> >
> > Any other ideas?  I do not want to break backward compatibility (or do
> > we to break compatibility, support more, and then release as 2.0?), but
> > I think that this is necessary to expand the flexibility of Digester.  I
> > will soon need to expose attributes, as I am working on a more complete
> > Xpath implementation.  That way we can also do something like
> > "tag/@name" (the name attribute of the tag element).
> >
> > As far as I can see, Digester is being used for simple configuration,
> > but stuff like documents that contain mixed content have an impossible
> > time right now, and I really do not want to have to use DOM to do this.
> > FYI, as a random thought, Digester could not actually be used to create
> > a DOM right now, because of this body text issue.
> >
> > Scott
> >
> >
> > --
> > To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.
> > org>
> > For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.
> > org>
> >
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message