cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Bowler" <paulbow...@www.aventix.co.uk>
Subject Re: Parsing XML input stream in Transformer
Date Fri, 16 May 2003 11:43:47 GMT
On 16 May 2003 13:30:26 +0200, Bruno Dumon wrote
> On Fri, 2003-05-16 at 12:38, Paul Bowler wrote:
> > Hi all,
> > 
> > I am creating a transformer that takes the xml events from a generator and uses
this to create a call to a legacy 
> > application. This legacy app returns (thankfully) XML via an input stream and I
want to parse this stream into SAX 
> > events to then pass down the chain.
> > 
> > I would normally (outside cocoon) use a SAXParserFactory and SaxParser to perform
the translation from stream to 
sax, 
> > but how should I do this in cocoon? I'm sure it's simple but I have found no examples
that do this from an xml 
stream.
> > 
> 
> Cocoon 2.0 or 2.1?
> 
> Basically you need to lookup the parser component from the
> componentmanager, but it changed a bit between the two versions.
> 
> -- 
> Bruno Dumon                             http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> bruno@outerthought.org                          bruno@apache.org


Cocoon 2.1.

I have managed to do this now using:

	org.apache.xerces.parsers.SAXParser p = new org.apache.xerces.parsers.SAXParser();
	p.setContentHandler(super.contentHandler);
	try {
		p.parse(new InputSource(is));
	} catch (SAXException e) {
		throw new ProcessingException("XML document received is not valid", e);
	}

but I'm sure this is not the best way as it places reliance on xerces.

Does anyone have a more 'open' suggestion?

Paul.

--
Paul Bowler
Aventix Associates Ltd

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


Mime
View raw message