You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Grzegorz Tańczyk <go...@polzone.pl> on 2005/03/02 01:31:21 UTC

SAXParser.parse alternative?

Hello!

  I'm trying to code a simple custom generator and I have problem
  which I can't fix.

  Main functionaliity of this generator is to get text from external resource,
  parse it and put it into content handler. But when I use:

  (SAXParser)parser.parse(new InputSource(new StringReader("<Element></Element>")), this.contentHandler);

  I got exception:
java.lang.RuntimeException
        at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3364)
        at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.ja
va:427)
        at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
        at org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer.java:549)
        at mycustomgenerator.generate(mycustomgenerator.java:123)
        [...]

  Is this problem common for someone? How to fix it or walk around it?

  Maybe this could be some clue: I have NullPointerException if I switch to XSLTC.

  Thanks for any help.

-- 
Best regards,
 Grzegorz                          mailto:goliatus@polzone.pl


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


Re[2]: SAXParser.parse alternative?

Posted by Grzegorz Tańczyk <go...@polzone.pl>.
Hello Geert,

  Custom Source implementation is the solution for me. Thanks.

Friday, March 4, 2005, 9:08:23 AM, you wrote:
GJ> If you are just trying to parse an XML string, why not use parseXML?

GJ> Alternative to the generate stuff: define you own pseudo
GJ> protocol and write a Source implementation 
GJ> for it. The ZipSource associated with the zip: protocol is a nice example.

GJ> Cheers,
GJ> Geert

GJ> Grzegorz Tańczyk wrote:

>> Hello!
>> 
>>   I'm trying to code a simple custom generator and I have problem
>>   which I can't fix.
>> 
>>   Main functionaliity of this generator is to get text from external resource,
>>   parse it and put it into content handler. But when I use:
>> 
>>   (SAXParser)parser.parse(new InputSource(new
>> StringReader("<Element></Element>")), this.contentHandler);
>> 
>>   I got exception:
>> java.lang.RuntimeException
>>         at
>> org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3364)
>>         at
>> org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.ja
>> va:427)
>>         at
>> org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
>>         at
>> org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer.java:549)
>>         at mycustomgenerator.generate(mycustomgenerator.java:123)
>>         [...]
>> 
>>   Is this problem common for someone? How to fix it or walk around it?
>> 
>>   Maybe this could be some clue: I have NullPointerException if I switch to XSLTC.
>> 
>>   Thanks for any help.
>> 




-- 
Best regards,
 Grzegorz                            mailto:goliatus@polzone.pl


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


Re: SAXParser.parse alternative?

Posted by Geert Josten <Ge...@daidalos.nl>.
If you are just trying to parse an XML string, why not use parseXML?

Alternative to the generate stuff: define you own pseudo protocol and write a Source implementation 
for it. The ZipSource associated with the zip: protocol is a nice example.

Cheers,
Geert

Grzegorz Tańczyk wrote:

> Hello!
> 
>   I'm trying to code a simple custom generator and I have problem
>   which I can't fix.
> 
>   Main functionaliity of this generator is to get text from external resource,
>   parse it and put it into content handler. But when I use:
> 
>   (SAXParser)parser.parse(new InputSource(new StringReader("<Element></Element>")), this.contentHandler);
> 
>   I got exception:
> java.lang.RuntimeException
>         at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3364)
>         at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.ja
> va:427)
>         at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
>         at org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer.java:549)
>         at mycustomgenerator.generate(mycustomgenerator.java:123)
>         [...]
> 
>   Is this problem common for someone? How to fix it or walk around it?
> 
>   Maybe this could be some clue: I have NullPointerException if I switch to XSLTC.
> 
>   Thanks for any help.
> 

-- 
Geert.Josten@Daidalos.nl
IT-consultant at Daidalos BV, Zoetermeer (NL)

http://www.daidalos.nl/
tel:+31-(0)79-3316961
fax:+31-(0)79-3316464

GPG: 1024D/12DEBB50

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


Re: SAXParser.parse alternative?

Posted by Antonio Gallardo <ag...@agssa.net>.
On Jue, 3 de Marzo de 2005, 16:50, Daniel McOrmond dijo:
> Grzegorz,
>
> Why not just use the TextGenerator? [1]
>
> If that doesn't suit your needs, at least take a look at the source.
> Maybe it'll help with your problem.

Also, to see how to parse another type of info, check the
DirectoryGenerator or other Generator code:

http://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/generation/

Best Regards,

Antonio Gallardo

>
> Hope this helps,
>
> -Daniel
>
> [1]
> <http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/generation/TextGenerator.html>
>
> ---------------------------------------------------------------------
> 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


Re: SAXParser.parse alternative?

Posted by Daniel McOrmond <dm...@gmail.com>.
Grzegorz,

Why not just use the TextGenerator? [1]

If that doesn't suit your needs, at least take a look at the source.
Maybe it'll help with your problem.

Hope this helps,

-Daniel

[1] <http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/generation/TextGenerator.html>

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


Re: SAXParser.parse alternative?

Posted by Jorg Heymans <jh...@domek.be>.
Upayavira wrote:
> Daniel McOrmond wrote:
> 
>> I guess I just don't like seeing two copies of the same thing in my 
>> inbox. ;)

you could subscribe through gmane to read the list. It makes reading the 
list just like reading a newsgroup. Now if only thunderbird had better 
newsgroup support <sigh>

cheers
Jorg


Re: SAXParser.parse alternative?

Posted by Upayavira <uv...@upaya.co.uk>.
Daniel McOrmond wrote:
> Ok. But, don't you guys also monitor the users@ list as well?
> 
> I guess I just don't like seeing two copies of the same thing in my inbox. ;)

Some do, not all. It is a lot of stuff to take in, hence it being worth 
going to the dev list if no resolution comes.

Regards, Upayavira

Re: SAXParser.parse alternative?

Posted by Daniel McOrmond <dm...@gmail.com>.
Ok. But, don't you guys also monitor the users@ list as well?

I guess I just don't like seeing two copies of the same thing in my inbox. ;)

-Daniel


On Fri, 04 Mar 2005 09:06:24 +0100, Jorg Heymans <jh...@domek.be> wrote:
> A lot of users bring their issues to dev@ when they don't get an answer
> on user@. This is quite allright, no need to play spamcop here :)

Re: SAXParser.parse alternative?

Posted by Jorg Heymans <jh...@domek.be>.
Daniel McOrmond wrote:
> Grzegorz,
> 
> The dev list is for discussion about development _of_ Cocoon itself,
> not development _using_ Cocoon.
> 
> Most members of the development team keep an eye on the users list, so
> you won't gain anything by spamming this dev list.

A lot of users bring their issues to dev@ when they don't get an answer 
on user@. This is quite allright, no need to play spamcop here :)

> 
> -Daniel
Jorg


Re: SAXParser.parse alternative?

Posted by Daniel McOrmond <dm...@gmail.com>.
Grzegorz,

The dev list is for discussion about development _of_ Cocoon itself,
not development _using_ Cocoon.

Most members of the development team keep an eye on the users list, so
you won't gain anything by spamming this dev list.

-Daniel

Fwd: SAXParser.parse alternative?

Posted by Grzegorz Tańczyk <go...@polzone.pl>.
This is a forwarded message
From: Grzegorz Tańczyk <go...@polzone.pl>
To: users@cocoon.apache.org
Date: Wednesday, March 2, 2005, 1:31:21 AM
Subject: SAXParser.parse alternative?

===8<==============Original message text===============
Hello!

  I'm trying to code a simple custom generator and I have problem
  which I can't fix.

  Main functionaliity of this generator is to get text from external resource,
  parse it and put it into content handler. But when I use:

  (SAXParser)parser.parse(new InputSource(new StringReader("<Element></Element>")), this.contentHandler);

  I got exception:
java.lang.RuntimeException
        at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3364)
        at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.ja
va:427)
        at org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:56)
        at org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer.java:549)
        at mycustomgenerator.generate(mycustomgenerator.java:123)
        [...]

  Is this problem common for someone? How to fix it or walk around it?

  Maybe this could be some clue: I have NullPointerException if I switch to XSLTC.

  Thanks for any help.

-- 
Best regards,
 Grzegorz                          mailto:goliatus@polzone.pl


===8<===========End of original message text===========



-- 
Best regards,
 Grzegorz                            mailto:goliatus@polzone.pl