cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Baun, Kevin" <kb...@cghtech.com>
Subject RE: unescaping xml in XSP-page
Date Wed, 10 Mar 2004 02:36:32 GMT
I had to fiddle with it for a while but it does work! thank you very much,
this has been very useful. I ending up doing something a little different so
here it is incase it can help somdbody else.

// content area of xsp
<TABLE id="whatever" height="100" cellSpacing="0" cellPadding="0"
width="300" border="0">
<TBODY>
<xsp:logic><![CDATA[
htmlStr ="<tableRows>";
htmlStr +="<TR>"+(myObj.myMethod(generateMyFrickinLayout)).trim()+"</TR>";
htmlStr +="</tableRows>";
XSPUtil.includeString(htmlStr, this.manager, this.contentHandler);
]]></xsp:logic>
</TBODY>
</TABLE>
// end

caviats:
1) the htmlStr has to be a complete, well formated, xml document. with
single root element blah blah blah...
2) you may pass in a well formated doc but the includeString method seems to
pretty much do whatever the heck it wants too. It looks like it is trying to
make 'nice' on what you put in. example. 
<td><img src="../blarg.pft" width="100" height="200"></td> <- this bombed,
of course
<td><img src=\"../blarg.pft\" width=\"100\" height=\"200\" /></td> <-
this
still bombed, huh?
<td><img src='../blarg.pft' width='100' height='200'></img></td> <-
this
worked, but returned <td></td><img... 
<td><img src='../blarg.pft' width='100' height='200' /></td> <- this
works,
for me

thanks for all of the help everybody!
-Mel


-----Original Message-----
From: Rob Gregory [mailto:Minty@RosesGroup.com]
Sent: Tuesday, March 09, 2004 2:44 PM
To: users@cocoon.apache.org
Subject: AW: unescaping xml in XSP-page



I was also having a similar problem and like most trawled Google and the
news lists looking for an answer. Most topics suggested using
include-expr which I tried in the following format

<util:include-expr>_xml</util:include-expr> <!-- _xml is my string -->

As suggested in the posts which didn't work...

Also tried
<util:include-expr><xsp:expr>_xml</xsp:expr></util:include-expr>
& loads of other routes...

Eventually I had a look at the util XSLT and found that the string you
want included should be specified as an expr attribute as follows:-

      String _xml = xmlUtil.getXML(_text); <!-- xmlUtil is my class -->
      <util:include-expr expr="_xml"/>

This worked great for me so might be worth a try if like myself you have
been misled from some posting on the net.

Hope this helps
Rob

> 
> I seem to be having a very simular issue.
> I have a method which returns generated dhtml, and all of the 
> '<' and '>'
> are also replaced with '&lt;' and '&gt;'. Any ideas?
> -Mel
> 
> 
> On 11.02.2004 09:45, Erik Hofstra wrote:
> 
> > Hi all,
> > 
> > I have a problem with my xml-string. From a XSP-page i call 
> a JavaClass
> > which makes a SOAP-call. The JavaClass returns a XML document in
> > String type.
> > When i place this string in my page with <xsp:expr> the '<' 
> and '>' of the
> > XML string are replaced with '&lt;' and '&gt;'. Because of this
> replacement
> > the transformer doesn't 'recognize' the tags.
> > I tried <util:include-expr>, unescapeXml, unescapeHtml and even the
> > string.replaceAll() method (:S) but nothing helps.
> > 
> > Does anyone knows how to solve this problem or has an idea?
> > 
> > Thanks!
> > Erik
> > 
> > btw, here is a piece of my XSP code:
> > <xsp:logic>
> >     String xmlString = soapCall.doSOAPCall();
> > </xsp:logic>
> > 
> > <xsp:expr>xmlString</xsp:expr>
> 
> There are get-xml or getxml elements somewhere. Somebody else can 
> probably tell you how to use them exactly, I never used them.
> 
> Joerg
> 



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

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


Mime
View raw message