My version of this solution is as follows:
I need to replace CRLF in data from a RDBMS with <br/> tags, these are being
sanitized by JXTemplate.
In my flowscript I have the following code.
importClass(Packages.org.w3c.dom.Document);
importClass(Packages.javax.xml.parsers.DocumentBuilderFactory);
importClass(Packages.org.xml.sax.InputSource);
.
.
.
function ConvertToXML(str){
var doc = null;
if(str instanceof String){
str = "<xhtml:span>" + str.replaceAll("(\r\n|\r|\n|\n\r)",
"<xhtml:br/>") + "</xhtml:span>";
doc =
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new
InputSource(new java.io.StringReader(str)));
}
return doc;
}
anil wrote:
>
>
> Hi everyone -
>
> I managed to find a solution to this which was (rather annoyingly) pretty
> simple!
>
> In the end instead of using an XML string and trying to get that to
> display, I returned a w3c.DOM.document object to the jx template itself &
> this handled outputing the xml for me.
>
> Anyway, I just thought I would complete the post as a reference for any
> other newbies out there.
>
> Many thanks,
> Anil.
>
>
--
View this message in context:
http://www.nabble.com/JX-templating---XML-tp14701516p14795132.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]