Re: Getting a parser

2002-07-09 Thread Ugo Cei

Vadim Gritsenko wrote:
>>From: Ugo Cei [mailto:[EMAIL PROTECTED]]
>>I came up with:
>>
>>  import org.apache.cocoon.components.parser.Parser;
> 
> 
> Use org.apache.avalon.excalibur.xml.Parser.
> 
> Vadim

Don't you just love it when interfaces change in an incompatible way and 
  there are no relevant docs on the Avalon site? ;-)

By the way, I was using these instructions:

 parser.setConsumer(new IncludeXMLConsumer(xmlConsumer));
 parser.parse(is);

Turns out there are no such methods in 
org.apache.avalon.excalibur.xml.Parser. What is a poor developer to do? 
Just use javap! A little ingenuity and here is the solution:

 parser.parse(is, new IncludeXMLConsumer(xmlConsumer));

and it's even shorter :-).

Such is life on the bleeding edge ;-).

--
Ugo Cei - http://beblogging.com/


-
Please check that your question  has not already been answered in the
FAQ before posting. 

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




RE: Getting a parser

2002-07-09 Thread Vadim Gritsenko

> From: Ugo Cei [mailto:[EMAIL PROTECTED]]
> 
> Hi people,
> 
> I need to get an handle to a parser in a Generator I am currently
> writing. So, I've copied a couple of lines from the ESQL logicsheet
> (2.0.3dev) because I remembered it did something like that. This is
what
> I came up with:
> 
>   import org.apache.cocoon.components.parser.Parser;

Use org.apache.avalon.excalibur.xml.Parser.

Vadim


> 
>   ...
> 
>   parser = (Parser) manager.lookup(Parser.ROLE);
> 
> This works, but the compiler complains that Parser is deprecated, and
> indeed the javadocs says that I should use the Avalon XML Parser.
> 
> So, if I want to make the compiler happy and avoid having my code
break
> in the future, what am I supposed to do? Does anyone have a correct
code
> snippet for getting an XML Parser?
> 
>   Ugo
> 
> --
> Ugo Cei - http://beblogging.com/


-
Please check that your question  has not already been answered in the
FAQ before posting. 

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




Getting a parser

2002-07-09 Thread Ugo Cei

Hi people,

I need to get an handle to a parser in a Generator I am currently 
writing. So, I've copied a couple of lines from the ESQL logicsheet 
(2.0.3dev) because I remembered it did something like that. This is what 
I came up with:

import org.apache.cocoon.components.parser.Parser;

...

parser = (Parser) manager.lookup(Parser.ROLE);

This works, but the compiler complains that Parser is deprecated, and 
indeed the javadocs says that I should use the Avalon XML Parser.

So, if I want to make the compiler happy and avoid having my code break 
in the future, what am I supposed to do? Does anyone have a correct code 
snippet for getting an XML Parser?

Ugo

-- 
Ugo Cei - http://beblogging.com/


-
Please check that your question  has not already been answered in the
FAQ before posting. 

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