Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 2368 invoked by uid 500); 27 Jan 2003 18:18:21 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 2350 invoked from network); 27 Jan 2003 18:18:20 -0000 Message-ID: <3E357819.5040502@cbim.it> Date: Mon, 27 Jan 2003 19:19:05 +0100 From: Ugo Cei Organization: C.B.I.M. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2) Gecko/20021202 X-Accept-Language: en-us, en MIME-Version: 1.0 To: cocoon-dev@xml.apache.org Subject: What is a Parser? Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Once upon a time there was a org.apache.cocoon.components.parser.Parser, but now it's deprecated. OK, so I think I should use the Excalibur parser component, which has recently been split into a SAX parser and a DOM parser. Looking in excalibur-xmlutil-20030122.jar, I found this class: org.apache.excalibur.xml.sax.Parser. Maybe I can use that. This is my first try: org.apache.excalibur.xml.sax.Parser saxParser = null; try { saxParser = (org.apache.excalibur.xml.sax.Parser) manager.lookup(org.apache.excalibur.xml.sax.Parser.ROLE); } finally { if (saxParser != null) manager.release(saxParser); } Unfortunately, it doesn't compile, because Parser does not implement Component, so I resolve the problem with a cast: if (saxParser != null) manager.release((Component) saxParser); I'm starting to feel a little bit confused, because I was not aware that in Java you could get away with that at compile time. Maybe I should have a look at the JLS, but since I'm lazy and my code runs, I figure I'd better ask cocoon-dev ;-). Is this the kosher way of obtaining an XML parser in Cocoon 2.1? To further complicate things, Eclipse does not like my little class which implements org.apache.avalon.framework.component.Component, since it insists that the type Component is deprecated, along with ComponentManager. In order to play by the rules, I've removed "Component" from the interfaces my class implements, but Cocoon (or is it Excalibur?) barfs with a "ClassCastException" when I try to put it in cocoon.xconf. Well, I just put back the "implements Component" declaration and live with Eclipse's warnings, but I cannot help feeling a little disoriented about all this ;-). Ugo --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org