[jdom-interest] retrieving the children of an element as text
Jason Hunter
jhunter at servlets.com
Wed Sep 13 11:18:24 PDT 2006
I'd recommend xmlOutputter.outputString(mainelement.getContent()).
You could also output the entire mainelement with
outputString(mainelement) and then rip off the outer tags manually.
-jh-
Fabrizio Lippolis wrote:
> Hi,
>
> I have an element and I want to retrieve a String which contains the
> children of my element including their text. For example if I have
> mainelement in this way
>
> <mainelement>
> <one>one</one>
> <two>two</two>
> </mainelement>
>
> then I want to get
>
> <one>one</one>
> <two>two</two>
>
> I should also respect the formatting so that if I have
>
> <mainelement>
> <one>one</one><two>two</two>
> </mainelement>
>
> I should get
>
> <one>one</one><two>two</two>
>
> Any suggestion please?
>
> Best regards,
> Fabrizio
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
>
More information about the jdom-interest
mailing list