commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@gmail.com>
Subject Re: [Digester] using (X)HTML in XML
Date Wed, 12 Jan 2005 23:38:31 GMT
On Wed, 12 Jan 2005 20:41:51 +0100, Matthias Wessendorf
<mailings@matthias-wessendorf.de> wrote:
> Wendy, Craig,
> 
> thanks for the responses.
> 
> Is't it posible to say
> "all what's inside of <text>, should be *copied*
> to property "value" of clazz "Text" ?
> 
> like a String "fooBar<br/>barFoo"
> 
> Or will I need to create own Rule clazzes?
> 

If you want that literal output, then you will indeed need to create
your own Rule instance.  Or, use NodeCreateRule and then write some
code to serialize the result as a string.  If you go the "write your
own" route, the code in NodeCreateRule might still serve as a good
starting point, because you are going to have to intercept all the SAX
events inside your matching area anyway.

Craig

> I need this, since I must configure output
> for a JSF web app. One of my BackingBeans
> contains a Vector with all "<text>"-"Objects".
> (each JSF pages got's a <text> value on Random...)
> 
> So I am not allowed to code it hard...
> (It is a *prototype* which will be compined
> with a custom layout engine that generates HTML, WML, ...)
> 
> However, any hint? I am turning OT ... :-)
> 
> > -----Original Message-----
> > Wrom: PQQWOYIYZUNNYCGPKYLEJGDGVCJVTLBXFGGMEPYOQKED
> > Sent: Wednesday, January 12, 2005 7:54 PM
> > To: Jakarta Commons Users List
> > Subject: Re: [Digester] using (X)HTML in XML
> >
> >
> > The issue is that you're wanting to read body text in
> > addition to elements and attributes, and Digester was never
> > really targeted for that use case.
> >
> > If you really want to do something like this, check out
> > NodeCreateRule, which will give you back a DOM structure
> > representing the nested content.  In your example, you'd get
> > back a <text> element with three children ... the leading
> > body content, the <br> element, and the trailing body content
> > ... but at least you'd be maintaining the structure.
> >
> > Craig
> >
> >
> >
> > On Wed, 12 Jan 2005 14:03:16 +0100, Matthias Wessendorf
> > <mailings@matthias-wessendorf.de> wrote:
> > > Hi,
> > >
> > > I run into a problem with digester,
> > > when include (X)HTML in a XML file
> > > that I want to read with Digester.
> > >
> > > I've an XML and ne of those values contain
> > > (X)HTML:
> > > <root>
> > > ...
> > > <texte>
> > >  <text>Nice to see you!<br/>Please be sure...</text>
> > >  ...
> > > </texte>
> > > ...
> > > </root>
> > >
> > > Now I thought the String that is read by Digester
> > > would be "Nice to see you!<br/>Please be sure..."
> > >
> > > NO! it doesn't contain "<br/>"
> > >
> > > like: "Nice to see you!Please be sure..."
> > >
> > > Am I doing something wrong?
> > >
> > > Best regards,
> > > Matthias
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > commons-user-help@jakarta.apache.org
> > >
> > >
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message