You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Dustin N. Jenkins" <dj...@invoqsystems.com> on 2005/07/25 18:45:40 UTC

toXML() within XML file

Is there anyway to get Cocoon to recognize the output of my POJO's 
toXML() method within my XML file?  Right now it treats the resulting 
XML as just a String and displays it as such. 

<schedule>#{times}</schedule>

The output of the 'times' variable is XML, how do I make Cocoon realize 
it?  The XML is built using JDOM, does that really matter in the end 
when the toXML() just ouputs a String?  Should I be outputting a 
Document or something different?

Many thanks,
Dustin

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


Re: toXML() within XML file

Posted by "Dustin N. Jenkins" <dj...@invoqsystems.com>.
Interesting, thank you for the response.  I've never used xmodule 
before, I'll give it a go.

Dustin



Mark Lundquist wrote:

>
> On Jul 25, 2005, at 10:11 AM, Dustin N. Jenkins wrote:
>
>> The XML String is being output OK, the problem is that Cocoon won't 
>> try to transform it, although it will transform the XML around it.  
>> If I look at the raw XML, the XML spit out from the call to toXML() 
>> is being treated as any other String display output, and not XML, 
>> (i.e. the client browser sees XML and not transformed HTML).
>
>
> Yes, of course.
>
> I guess JXTemplate doesn't know how to interpolate XML, because it 
> would have to use its expression evaluators for this, and neither of 
> its expression languages (JXPath nor JExL) can express that.
>
> But you should be able to just create a pipeline to stream the object 
> as XML using the XModule source, then use Cinclude or Xinclude to pull 
> that in to your template.  You'll be "pulling" your object through 
> another request, which means that the URI matched by this pipeline 
> will have to encode any parameters needed to retrieve/create the 
> object.  Makes sense?
>
> So actually you have two new pipelines: one that invokes a flowscript 
> function to get the object, then calls sendPage() on the second 
> pipeline, which contains
>
>     <generate src="xmodule:flow-attribute:time"/>
>
> GL,
> —ml—
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

-- 
Dustin N. Jenkins
Application Developer
Invoq Systems, Inc.
AlarmPoint - Critical Event Interactive Alerting
#216 - 852 Fort Street
Victoria, BC V8W 1H8
Tel: (250) 380-0304
djenkins@invoqsystems.com <ma...@invoqSystems.com>
http://www.invoqsystems.com

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


Re: toXML() within XML file

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Jul 25, 2005, at 10:11 AM, Dustin N. Jenkins wrote:

> The XML String is being output OK, the problem is that Cocoon won't 
> try to transform it, although it will transform the XML around it.  If 
> I look at the raw XML, the XML spit out from the call to toXML() is 
> being treated as any other String display output, and not XML, (i.e. 
> the client browser sees XML and not transformed HTML).

Yes, of course.

I guess JXTemplate doesn't know how to interpolate XML, because it 
would have to use its expression evaluators for this, and neither of 
its expression languages (JXPath nor JExL) can express that.

But you should be able to just create a pipeline to stream the object 
as XML using the XModule source, then use Cinclude or Xinclude to pull 
that in to your template.  You'll be "pulling" your object through 
another request, which means that the URI matched by this pipeline will 
have to encode any parameters needed to retrieve/create the object.  
Makes sense?

So actually you have two new pipelines: one that invokes a flowscript 
function to get the object, then calls sendPage() on the second 
pipeline, which contains

	<generate src="xmodule:flow-attribute:time"/>

GL,
—ml—


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


Re: toXML() within XML file

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Jul 25, 2005, at 10:11 AM, Dustin N. Jenkins wrote:

> The XML String is being output OK, the problem is that Cocoon won't 
> try to transform it, although it will transform the XML around it.  If 
> I look at the raw XML, the XML spit out from the call to toXML() is 
> being treated as any other String display output, and not XML, (i.e. 
> the client browser sees XML and not transformed HTML).

Oh yeah.  Duh, I answered too quickly... :-/
—ml—


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


Re: toXML() within XML file

Posted by "Dustin N. Jenkins" <dj...@invoqsystems.com>.
The XML String is being output OK, the problem is that Cocoon won't try 
to transform it, although it will transform the XML around it.  If I 
look at the raw XML, the XML spit out from the call to toXML() is being 
treated as any other String display output, and not XML, (i.e. the 
client browser sees XML and not transformed HTML).

My example in the previous post shows a JX path passed in by the 
JavaScript flow.

DNJ




Mark Lundquist wrote:

>
> On Jul 25, 2005, at 9:45 AM, Dustin N. Jenkins wrote:
>
>> Is there anyway to get Cocoon to recognize the output of my POJO's 
>> toXML() method within my XML file?  Right now it treats the resulting 
>> XML as just a String and displays it as such.
>> <schedule>#{times}</schedule>
>>
>> The output of the 'times' variable is XML, how do I make Cocoon 
>> realize it?  The XML is built using JDOM, does that really matter in 
>> the end when the toXML() just ouputs a String?  Should I be 
>> outputting a Document or something different?
>
>
> You mean in a JXTemplate, right?  Just write:
>
>     <schedule>${times.toXML()}</schedule>
>
> HTH,
> —ml—
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

-- 
Dustin N. Jenkins
Application Developer
Invoq Systems, Inc.
AlarmPoint - Critical Event Interactive Alerting
#216 - 852 Fort Street
Victoria, BC V8W 1H8
Tel: (250) 380-0304
djenkins@invoqsystems.com <ma...@invoqSystems.com>
http://www.invoqsystems.com

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


Re: toXML() within XML file

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Jul 25, 2005, at 9:45 AM, Dustin N. Jenkins wrote:

> Is there anyway to get Cocoon to recognize the output of my POJO's 
> toXML() method within my XML file?  Right now it treats the resulting 
> XML as just a String and displays it as such.
> <schedule>#{times}</schedule>
>
> The output of the 'times' variable is XML, how do I make Cocoon 
> realize it?  The XML is built using JDOM, does that really matter in 
> the end when the toXML() just ouputs a String?  Should I be outputting 
> a Document or something different?

You mean in a JXTemplate, right?  Just write:

	<schedule>${times.toXML()}</schedule>

HTH,
—ml—


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