NewBee - Dynamically created XML

2003-01-13 Thread Steve Millington
Being a newbee to Cocoon, I am wondering if someone can help me with a 
quick strategy to solve the following problem.

I already have a Java program that can produce XML text.

For example, I have a java Bean that has a generate() method that 
returns a String that contains a valid XML fragment.

I would like to use this generate XML in a pipeline, but I can't figure 
it out. The method of attack I used was to use XSP and have an xsp page 
something like:

?xml version=1.0 encoding=ISO-8859-1?

xsp:page language=java
xmlns:xsp=http://apache.org/xsp;
xmlns:xsp-request=http://apache.org/xsp/request/2.0;

xsp:structure
 xsp:includecom.mystuff.MyBean/xsp:include
/xsp:structure

page
 xsp:logic
  MyBean mb = new MyBean();
  String theXML = mb.generate();
 /xsp:logic
 xsp:exprtheXML/xsp:expr
/page

/xsp:page

This does not work as I had hoped. The 'theXML' data is not placed into 
the XML tag tree, but rather is used as CDATA inside my page tag.
Is there something cunning I can do to persuade xsp that the data should 
be used to generate XML tag structure, rather than it being textual data.

Or maybe I am barking up the wrong Tree. I would write some 
implementation of Generator, but that looked a bit too complex for my 
liking since it would probably require the coding of MyBean to produce 
some sore of parsed XML rather than the text.

Thanks for any help.

Steve



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

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]



Re: NewBee - Dynamically created XML

2003-01-13 Thread Cocoon User

use aggregation in site map

to create a final xml from some xml fragments

we have test many ways to solve a problem like this
from xsp (dynamic pages) to c or x include but we have a least descide
touse sitemap aggregation

stavros



On Mon, 13 Jan 2003, Steve Millington wrote:

 Being a newbee to Cocoon, I am wondering if someone can help me with a
 quick strategy to solve the following problem.

 I already have a Java program that can produce XML text.

 For example, I have a java Bean that has a generate() method that
 returns a String that contains a valid XML fragment.

 I would like to use this generate XML in a pipeline, but I can't figure
 it out. The method of attack I used was to use XSP and have an xsp page
 something like:

 ?xml version=1.0 encoding=ISO-8859-1?

 xsp:page language=java
 xmlns:xsp=http://apache.org/xsp;
 xmlns:xsp-request=http://apache.org/xsp/request/2.0;

 xsp:structure
   xsp:includecom.mystuff.MyBean/xsp:include
 /xsp:structure

 page
   xsp:logic
MyBean mb = new MyBean();
String theXML = mb.generate();
   /xsp:logic
   xsp:exprtheXML/xsp:expr
 /page

 /xsp:page

 This does not work as I had hoped. The 'theXML' data is not placed into
 the XML tag tree, but rather is used as CDATA inside my page tag.
 Is there something cunning I can do to persuade xsp that the data should
 be used to generate XML tag structure, rather than it being textual data.

 Or maybe I am barking up the wrong Tree. I would write some
 implementation of Generator, but that looked a bit too complex for my
 liking since it would probably require the coding of MyBean to produce
 some sore of parsed XML rather than the text.

 Thanks for any help.

 Steve



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

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]




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

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: NewBee - Dynamically created XML

2003-01-13 Thread Geoff Howard
Check out the util logicsheet (documentation is poor - you'll have to look
at the source).  You'd find it at
http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/src/java/org/apache/cocoon/com
ponents/language/markup/xsp/java/util.xsl?rev=1.7content-type=text/vnd.view
cvs-markup

I think you'll want to do:
...
page
   xsp:logic
MyBean mb = new MyBean();
String theXML = mb.generate();
   /xsp:logic
   util:include-expr
   util:exprxsp:exprtheXML/xsp:expr/util:expr
   /util:include-expr
/page
...

Make sure to include the util namespace in the doc:
xmlns:util=http://apache.org/xsp/util/2.0;

HTH,
Geoff Howard

 -Original Message-
 From: Steve Millington [mailto:[EMAIL PROTECTED]]
 Sent: Monday, January 13, 2003 12:11 PM
 To: [EMAIL PROTECTED]
 Subject: NewBee - Dynamically created XML


 Being a newbee to Cocoon, I am wondering if someone can help me with a
 quick strategy to solve the following problem.

 I already have a Java program that can produce XML text.

 For example, I have a java Bean that has a generate() method that
 returns a String that contains a valid XML fragment.

 I would like to use this generate XML in a pipeline, but I can't figure
 it out. The method of attack I used was to use XSP and have an xsp page
 something like:

 ?xml version=1.0 encoding=ISO-8859-1?

 xsp:page language=java
 xmlns:xsp=http://apache.org/xsp;
 xmlns:xsp-request=http://apache.org/xsp/request/2.0;

 xsp:structure
   xsp:includecom.mystuff.MyBean/xsp:include
 /xsp:structure

 page
   xsp:logic
MyBean mb = new MyBean();
String theXML = mb.generate();
   /xsp:logic
   xsp:exprtheXML/xsp:expr
 /page

 /xsp:page

 This does not work as I had hoped. The 'theXML' data is not placed into
 the XML tag tree, but rather is used as CDATA inside my page tag.
 Is there something cunning I can do to persuade xsp that the data should
 be used to generate XML tag structure, rather than it being textual data.

 Or maybe I am barking up the wrong Tree. I would write some
 implementation of Generator, but that looked a bit too complex for my
 liking since it would probably require the coding of MyBean to produce
 some sore of parsed XML rather than the text.

 Thanks for any help.

 Steve



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

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]





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

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]