cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: XMLReader question
Date Tue, 26 Apr 2005 22:29:35 GMT
On 01.10.2004 15:03, JACOB, ERIC wrote:
> Hi,
> 
> I use the XMLReader class into a custom transformer to parse an XML string
> like the following:
> 
> this.sendStartElementEvent( ROOT_ELEMENT );
> 
> XMLReader xmlReader = XMLReaderFactory.createXMLReader();
> xmlReader.setContentHandler( super.xmlConsumer );
> InputSource source = new InputSource( new StringReader( xmlString ) );
> xmlReader.parse( source );
> 
> this.sendEndElementEvent( ROOT_ELEMENT );
> 
> That works fine, but the output contains an undesired XML declaration:
> 
> <root>
>   <?xml version="1.0" encoding="ISO-8859-1"?>
>   <message>
>     ...
>   </message>
> </root>
> 
> How I could avoid this?

The content handler set on the XMLReader object must filter out 
startDocument and endDocument event by an empty implementation of both.

Joerg


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


Mime
View raw message