cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: [C2] Creating Document inside XSP
Date Thu, 17 May 2001 16:28:30 GMT


mannt@gmx.de a écrit :
> 
> hello,
> 
> i have an xsp-file with following tags:
> 
> ...
> <adress>
> <name><xsp:expr>adr.getName()</xsp:expr></name>
> <street><xsp:expr>adr.getStreet()</xsp:expr></street>
> <phone><xsp:expr>adr.getPhone()</xsp:expr></phone>
> ...
> </adress>
> 
> Now i would like to create with this tags an org.w3c.dom.Document inside the
> xsp-file. Could i access this tags directly with xsp? Or is the only way,
> create the Document manuel e.g. :
> 
> <xsp:logic>
> Document document = docBuilder.newDocument();
> 
> Element adress = document.createElement("adress");
> Element name= document.createElement("name");
> document.appendChild(adress);
> adress.appendChild(name);
> name.appendChild(document.createTextNode(adr.getName()));
> </xsp:logic>
> 
> Know anyone an easier way to do this?
> 

The XSP makes SAX calls to "this.contentHandler" to create elements. To
achieve what you want, you can locally replace it with a DOMBuilder,
which will build a Document.

But be careful :
- SAX events catched by the DOMBuilder will not appear in the XSP
result,
- don't forget to restore the original value for this.contentHandler
once the document is built or the rest of the XSP will be ignored.

> thanks,
> mannt
> 
> --
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
> 

-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message