commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Sanders" <ssand...@nextance.com>
Subject [Digester] Supporting mixed content
Date Fri, 04 Jan 2002 01:37:29 GMT
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>


Mime
View raw message