You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2004/06/03 08:28:45 UTC
Re: Is this good practice? [Was - Re: Newbie: How to capture
XMLfrom custom class? ]
Upayavira implies it should be do-able with the JXTemplateGenerator?
See:
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=108498565610794&w=2
Derek
>>> awalsh@contal.net.au 2004/06/03 08:12:54 AM >>>
Hi Derek,
in my case I did try using flow, but ran into a wall using JXTemplate
to
spit out the XML from my Java object:
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=108415092708767&w=2
If anyone has any ideas on how I can get around the escaping of the <
and > then I would glady ditch the XSP :)
Adam
Derek Hohls wrote:
>I see a lot of folks on the list still offering advice for
>incorporation
>of logic into XSP ... my understanding is that this approach is
>deprecated (and that even XSP was only ever a "stop gap" in the first
>instance) - are there any official or wiki docs that demonstrate
>a better way for logic incorporation [I would say via flow, but
>am not yet up-to-speed with that...]
>
>Derek
>
>
>
>>>>awalsh@contal.net.au 2004/06/03 02:10:22 AM >>>
>>>>
>>>>
>Hi Terry,
>
>I had a similar problem and used XSP with a couple of Java classes to
>generate the XML. Try sticking something like this in your XSP:
>
><xsp:logic>
> BusinessObject1 busOb = new BusinessObject1();
> busOb.setSomething(request.getParameter("something"));
> // do whatever else you need with the request object
>
> Document doc = null;
> try
> {
> DocumentBuilderFactory factory =
>DocumentBuilderFactory.newInstance();
> factory.setNamespaceAware(true);
> DocumentBuilder builder = factory.newDocumentBuilder();
> ByteArrayInputStream in = new
>ByteArrayInputStream(busOb.toString().getBytes("UTF8"));
> doc = builder.parse(new InputSource(in));
> }
> catch (Throwable t)
> {
> // do something with the error
> }
></xsp:logic>
><xsp:expr>doc.getDocumentElement()</xsp:expr>
>
>
>Hope that helps.
>
>Adam
>
>Terry Brick wrote:
>
>
>
>>Hello,
>>I've just started using Cocoon (2.1) and so far I'm loving it. The
>>
>>
>problem is that probably less
>
>
>>than 50% of my XML will be static. The rest will be dynamic
generated
>>
>>
>from SQL interaction, etc.
>
>
>>I want to do all (or most) of my business logic in regular ol' Java
>>
>>
>classes and just spit out the
>
>
>>XML in the right places. Ideally, I would like something like
>>
>>
>this...
>
>
>><doc>
>> <title>My Title</title>
>> <content>
>> <mynamespace:generate class="com.mycompany.businessobject1"/>
>> </content>
>></doc>
>>
>>Where the businessobject1.toString() representation is used to fill
in
>>
>>
>that section with XML and
>
>
>>where businessobject1 has access to the servlet context, request
>>
>>
>parameters, etc.
>
>
>>Anyway, I don't require it to be exactly as shown above, I'm just
>>
>>
>trying to illustrate my basic
>
>
>>requirements and am wondering what's the right approach in Cocoon.
>>It's probably obvious to existing users in the doc, but I'm just
>>
>>
>starting out and am having a hard
>
>
>>time getting some aspects of Cocoon. Do I simply need to write a
>>
>>
>custom generator? I don't want
>
>
>>to script things, but do I just need to use XSP to instantiate my
>>
>>
>class (but I need the servlet
>
>
>>request object)?
>>Could somebody please point me in the right direction?
>>
>>Thanks!
>>
>>
>>
>>
>>__________________________________
>>Do you Yahoo!?
>>Friends. Fun. Try the all-new Yahoo! Messenger.
>>http://messenger.yahoo.com/
>>
>>---------------------------------------------------------------------
>>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
>
>
>
>
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Is this good practice? [Was - Re: Newbie: How to capture XMLfrom
custom class? ]
Posted by Adam Walsh <aw...@contal.net.au>.
Unfortunately it produces the same output as the jx:out
Adam
Upayavira wrote:
> In the second email it says:
>
> <jx:out value="#{bean/someXML}"/> produces
> <SomeXML>blah</SomeXML>
>
> What does just #{bean/someXML} produce?
>
> Regards, Upayavira
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Is this good practice? [Was - Re: Newbie: How to capture XMLfrom
custom class? ]
Posted by Upayavira <uv...@upaya.co.uk>.
Derek Hohls wrote:
>Upayavira implies it should be do-able with the JXTemplateGenerator?
>
>See:
>http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=108498565610794&w=2
>
>
In the second email it says:
<jx:out value="#{bean/someXML}"/> produces <SomeXML>blah</SomeXML>
What does just #{bean/someXML} produce?
Regards, Upayavira
>Derek
>
>
>
>>>>awalsh@contal.net.au 2004/06/03 08:12:54 AM >>>
>>>>
>>>>
>Hi Derek,
>
>in my case I did try using flow, but ran into a wall using JXTemplate
>to
>spit out the XML from my Java object:
>
>http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=108415092708767&w=2
>
>
>If anyone has any ideas on how I can get around the escaping of the <
>and > then I would glady ditch the XSP :)
>
>Adam
>
>
>Derek Hohls wrote:
>
>
>
>>I see a lot of folks on the list still offering advice for
>>incorporation
>>of logic into XSP ... my understanding is that this approach is
>>deprecated (and that even XSP was only ever a "stop gap" in the first
>>instance) - are there any official or wiki docs that demonstrate
>>a better way for logic incorporation [I would say via flow, but
>>am not yet up-to-speed with that...]
>>
>>Derek
>>
>>
>>
>>
>>
>>>>>awalsh@contal.net.au 2004/06/03 02:10:22 AM >>>
>>>>>
>>>>>
>>>>>
>>>>>
>>Hi Terry,
>>
>>I had a similar problem and used XSP with a couple of Java classes to
>>
>>
>
>
>
>>generate the XML. Try sticking something like this in your XSP:
>>
>><xsp:logic>
>> BusinessObject1 busOb = new BusinessObject1();
>> busOb.setSomething(request.getParameter("something"));
>> // do whatever else you need with the request object
>>
>> Document doc = null;
>> try
>> {
>> DocumentBuilderFactory factory =
>>DocumentBuilderFactory.newInstance();
>> factory.setNamespaceAware(true);
>> DocumentBuilder builder = factory.newDocumentBuilder();
>> ByteArrayInputStream in = new
>>ByteArrayInputStream(busOb.toString().getBytes("UTF8"));
>> doc = builder.parse(new InputSource(in));
>> }
>> catch (Throwable t)
>> {
>> // do something with the error
>> }
>></xsp:logic>
>><xsp:expr>doc.getDocumentElement()</xsp:expr>
>>
>>
>>Hope that helps.
>>
>>Adam
>>
>>Terry Brick wrote:
>>
>>
>>
>>
>>
>>>Hello,
>>>I've just started using Cocoon (2.1) and so far I'm loving it. The
>>>
>>>
>>>
>>>
>>problem is that probably less
>>
>>
>>
>>
>>>than 50% of my XML will be static. The rest will be dynamic
>>>
>>>
>generated
>
>
>>>
>>>
>>>
>>>
>>from SQL interaction, etc.
>
>
>>
>>
>>
>>
>>>I want to do all (or most) of my business logic in regular ol' Java
>>>
>>>
>>>
>>>
>>classes and just spit out the
>>
>>
>>
>>
>>>XML in the right places. Ideally, I would like something like
>>>
>>>
>>>
>>>
>>this...
>>
>>
>>
>>
>>><doc>
>>><title>My Title</title>
>>><content>
>>> <mynamespace:generate class="com.mycompany.businessobject1"/>
>>></content>
>>></doc>
>>>
>>>Where the businessobject1.toString() representation is used to fill
>>>
>>>
>in
>
>
>>>
>>>
>>>
>>>
>>that section with XML and
>>
>>
>>
>>
>>>where businessobject1 has access to the servlet context, request
>>>
>>>
>>>
>>>
>>parameters, etc.
>>
>>
>>
>>
>>>Anyway, I don't require it to be exactly as shown above, I'm just
>>>
>>>
>>>
>>>
>>trying to illustrate my basic
>>
>>
>>
>>
>>>requirements and am wondering what's the right approach in Cocoon.
>>>It's probably obvious to existing users in the doc, but I'm just
>>>
>>>
>>>
>>>
>>starting out and am having a hard
>>
>>
>>
>>
>>>time getting some aspects of Cocoon. Do I simply need to write a
>>>
>>>
>>>
>>>
>>custom generator? I don't want
>>
>>
>>
>>
>>>to script things, but do I just need to use XSP to instantiate my
>>>
>>>
>>>
>>>
>>class (but I need the servlet
>>
>>
>>
>>
>>>request object)?
>>>Could somebody please point me in the right direction?
>>>
>>>Thanks!
>>>
>>>
>>>
>>>
>>>__________________________________
>>>Do you Yahoo!?
>>>Friends. Fun. Try the all-new Yahoo! Messenger.
>>>http://messenger.yahoo.com/
>>>
>>>---------------------------------------------------------------------
>>>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
>>
>>
>>
>>
>>
>>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org