cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Curdt" <tcu...@dff.st>
Subject RE: do not quote!
Date Fri, 07 Jul 2000 08:27:03 GMT
> > Now I would like to learn haow to do the 'build xml tree'
> > inside my own
> > Java-classes that handle the DB-stuff.
> >
> > Then I would need to know how to insert the xml-tree returned by my
> > Java-method into my xsp page.
> It's actually quite simple. Here's an example:
>
> DocumentFragment buildTree(Document document) {
[snip]
>     return fragment;
> }
> 
> Because of the way DocumentFragment works, when you appendChild() a
> DocumentFragment, it actually adds the children. So you could do the
> following in XSP:
> 
> <container>
>     <xsp:logic>
>         xspCurrentNode.appendChild(buildTree(document));
>     </xsp:logic>
> </container>
> 
> And you would get the following result:
> 
> <container>
>     <tag1>
>         Text for tag1.
>         <tag2>Text for tag2.</tag2>
>     </tag1>
>     <tag3>Text for tag3.</tag3>
> </container>

Thanks for this excellent snippet!
--
Torsten 

Mime
View raw message