You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Christian Zoffoli <cz...@littlepenguin.org> on 2002/03/21 21:16:20 UTC

BUG in RequestGenerator ?

Hi to all.
I found a problem using RequestGenerator. 

The generated document seems not processable by any processor (xalan,
saxon, MSXML)


output example:

--------------------------
<?xml version="1.0" encoding="UTF-8"?>
<request target="/betanews202-1/betanews/test.xml" source=""
xmlns="http://xml.apache.org/cocoon/requestgenerator/2.0">

<requestHeaders>
<header name="host">localhost:8080</header>
....
</requestHeaders>

<requestParameters>
<parameter name="email">
<value>prova@prova.com</value>

</parameter>
....

</requestParameters>

<configurationParameters>
</configurationParameters>

</request>

--------------------------


...from my point of view the problem is
'xmlns="http://xml.apache.org/cocoon/requestgenerator/2.0"'  

two possible solutions:
1- add a suffix to "xmlns" ---> xmlns:request
2- remove the namespace declaration (see the following stupid patch)


-- cut --
--- src/java/org/apache/cocoon/generation/RequestGenerator.java	Fri Feb
22 08:03:51 2002
+++ src/java/org/apache/cocoon/generation/RequestGenerator.java.new	Wed
Mar 20 03:39:37 2002
@@ -116,7 +116,7 @@
     throws SAXException {
         Request request = ObjectModelHelper.getRequest(objectModel);
         this.contentHandler.startDocument();
-        this.contentHandler.startPrefixMapping("",URI);
+        //this.contentHandler.startPrefixMapping("",URI);
         AttributesImpl attr=new AttributesImpl();

         this.attribute(attr,"target", request.getRequestURI());
-- cut --



Christian

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


Re: BUG in RequestGenerator ?

Posted by Christian Zoffoli <cz...@xmerlin.org>.
Jeremy Quinn wrote:
> 
[ cut]
> 
> what does the update-user_form_xupdate.xsl stylesheet look like?
> 
> I found I had to do some pretty strange stuff to get mine to work () see:
> xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/request2editor.xsl
> 
> I had to end up declaring the request namespace prefix, and matching with
> it, even though the request is generated using a default namespace, not a
> prefixed one.


thanks to your example, now it works fine :))



> 
> >I obtain the following error message 'XML Parsing Error: no element
> >found'
> >
> >
> >Why?
> 
> Maybe your XSLT is not copying anything.
> 
> Try putting a logger either side:
> 
> <map:match pattern="test2.xml">
>   <map:generate type="request"/>
> 
>         <map:transform type="log">
>                 <map:parameter name="logfile" value="before.log"/>
>                 <map:parameter name="append" value="no"/>
>         </map:transform>
> 
>   <map:transform src="stylesheets/update-user_form_xupdate.xsl" />
> 
>         <map:transform type="log">
>                 <map:parameter name="logfile" value="before.log"/>
>                 <map:parameter name="append" value="no"/>
>         </map:transform>
> 
>   <map:serialize type="xml"/>
> </map:match>
> 


...logger doesn't produce any file ...it's a bug or I have missed
something ?


Christian

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


Re: BUG in RequestGenerator ?

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 3:12 pm +0100 22/3/02, Christian Zoffoli wrote:
>Jeremy Quinn wrote:
>>
>> At 9:16 pm +0100 21/3/02, Christian Zoffoli wrote:
>> >Hi to all.
>> >I found a problem using RequestGenerator.

<snip/>

>My goal is to transform some request parameters into an xupdate
>document, usable with XMLDBTransformer.
>The transformation goes well if I apply the stylesheet from the console,
>but if I use a pipeline like the following one:
>
>
>------
>
><map:match pattern="test2.xml">
>	<map:generate type="request"/>
>
>	<map:transform src="stylesheets/update-user_form_xupdate.xsl" />
>
>	<map:serialize type="xml"/>
>
></map:match>

what does the update-user_form_xupdate.xsl stylesheet look like?

I found I had to do some pretty strange stuff to get mine to work () see:
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/request2editor.xsl

I had to end up declaring the request namespace prefix, and matching with
it, even though the request is generated using a default namespace, not a
prefixed one.

>I obtain the following error message 'XML Parsing Error: no element
>found'
>
>
>Why?

Maybe your XSLT is not copying anything.

Try putting a logger either side:

<map:match pattern="test2.xml">
  <map:generate type="request"/>

	<map:transform type="log">
		<map:parameter name="logfile" value="before.log"/>
		<map:parameter name="append" value="no"/>
	</map:transform>

  <map:transform src="stylesheets/update-user_form_xupdate.xsl" />

	<map:transform type="log">
		<map:parameter name="logfile" value="before.log"/>
		<map:parameter name="append" value="no"/>
	</map:transform>

  <map:serialize type="xml"/>
</map:match>

hope this helps

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
   <phone:+44.[0].20.7737.6831>             <pa...@vizzavi.net>

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


Re: BUG in RequestGenerator ?

Posted by Christian Zoffoli <cz...@xmerlin.org>.
Jeremy Quinn wrote:
> 
> At 9:16 pm +0100 21/3/02, Christian Zoffoli wrote:
> >Hi to all.
> >I found a problem using RequestGenerator.
> >
> >The generated document seems not processable by any processor (xalan,
> >saxon, MSXML)
> 
> I have it working (Xalan), but it was a real struggle!
> 
> I think part of the problem is the namespace settings, why not a proper
> prefix and not just a default namespace, I think it would make it a lot
> easier.
> 

first of all, thanks for your answer

After a little change I have obtained a processable document but now I
found another strange problem. 

My goal is to transform some request parameters into an xupdate
document, usable with XMLDBTransformer. 
The transformation goes well if I apply the stylesheet from the console,
but if I use a pipeline like the following one:


------

<map:match pattern="test2.xml">
	<map:generate type="request"/>

	<map:transform src="stylesheets/update-user_form_xupdate.xsl" />

	<map:serialize type="xml"/>

</map:match>

------


I obtain the following error message 'XML Parsing Error: no element
found'


Why?

Thanks,
	Christian

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


Re: BUG in RequestGenerator ?

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 9:16 pm +0100 21/3/02, Christian Zoffoli wrote:
>Hi to all.
>I found a problem using RequestGenerator.
>
>The generated document seems not processable by any processor (xalan,
>saxon, MSXML)

I have it working (Xalan), but it was a real struggle!

I think part of the problem is the namespace settings, why not a proper
prefix and not just a default namespace, I think it would make it a lot
easier.

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
   <phone:+44.[0].20.7737.6831>             <pa...@vizzavi.net>

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