You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Gould, Troy (ELS)" <T....@Elsevier.com> on 2003/05/27 23:47:12 UTC

using XML String in XSP

I'm using cocoon 2.0.4 and having difficulties with the
xsp-util:include-expr and xsp:expr tags.

I have a method in a class that returns a XML Document as a String which I
want to utilize within an xsp page.  However, I don't want the string to
come back as text because the '<' tag (and others) will be escaped as &lt;.
I want the returned xml string to become part of the SAX stream.

Originally, I was using:

<xsp:logic>
String testDoc = WebServiceClient.getDocument("testDoc.xml");

<content>
<xsp:expr>
testDoc
</xsp:expr>
</content>       

</xsp:logic>


Then, I went to using:
<xsp:logic>
String testDoc = WebServiceClient.getDocument("testDoc.xml");

<content>
<util:include-expr>
<util:expr>
testDoc
</util:expr>
</util:include-expr>
</content>       

</xsp:logic>

All this was doing was printing out XML with util:include-expr and util:expr
as tags.  The tag processor seems to not be processing my util namespace
tags.

I'm not sure what I'm doing wrong.  I see from reading documentation that
there was a "fix" in version 2.0.4 where <xsp-util:include-expr/> includes
any object, converting it to string.

The real problem is can I use XSP to get a XML Document as a String and
still have it put into the SAX stream as a Node or do I need to just write
my own custom generator to do this instead?

Thanks in advance!

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


Re: using XML String in XSP

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 27.May.2003 -- 04:47 PM, Gould, Troy (ELS) wrote:
> I'm using cocoon 2.0.4 and having difficulties with the
> xsp-util:include-expr and xsp:expr tags.
> 
> I have a method in a class that returns a XML Document as a String which I
> want to utilize within an xsp page.  However, I don't want the string to
> come back as text because the '<' tag (and others) will be escaped as &lt;.
> I want the returned xml string to become part of the SAX stream.

> Then, I went to using:
> <xsp:logic>
> String testDoc = WebServiceClient.getDocument("testDoc.xml");
> 
> <content>
  <util:include-expr><util:expr><xsp:expr>testDoc<xsp:expr></util:expr></util:include-expr>
> </content>       

(mind the whitespace!) or

 <content>
  <util:include-expr expr="testDoc"/>
 </content>       

> </xsp:logic>
> 
> All this was doing was printing out XML with util:include-expr and util:expr
> as tags.  The tag processor seems to not be processing my util namespace
> tags.

So, do you use the correct namespace for them? Does your XSP have a
correct structure (e.g. some top level tag starting the page?)

> The real problem is can I use XSP to get a XML Document as a String and
> still have it put into the SAX stream as a Node or do I need to just write
> my own custom generator to do this instead?

This is possible from XSP.

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

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