You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joerg Heinicke <jo...@gmx.de> on 2005/04/27 00:29:35 UTC

Re: XMLReader question

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