The xerces 1.0.4 serializers are not properly initialized until one of the as...Handler methods is invoked.
In your case call serializer.asContentHandler() before serializing.
 
This looks like a bug to me.
-----Original Message-----
From: Greg Matthews [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 14, 2000 6:53 PM
To: Xerces Dev
Subject: xerces-j 1.0.4 bug?

 
Dear all,
 
I just downloaded xerces-j 1.0.4 and wondered if this might be a bug?
 
under 1.0.3, the following worked.
 
   OutputFormat outputFormat = new OutputFormat();
   outputFormat.setOmitXMLDeclaration( true );
   outputFormat.setIndenting( false );
   outputFormat.setLineSeparator( "" );

  org.apache.xml.serialize.XMLSerializer serializer = new XMLSerializer( System.out, outputFormat );
 
  serializer.serialize( <someElement> );
 
 
i get the following error under 1.0.4
 
java.lang.IllegalStateException: SER002 No writer supplied for serializer
        at org.apache.xml.serialize.BaseMarkupSerializer.serialize(BaseMarkupSerializer.java:389)
 
seems like a protected variable in BaseMarkupSerializer, _printer, is not initialised
unless prepare() gets called.
 
i'm calling asDocumentHandler() just so prepare() gets called although i ignore the
return value.
 
Am i using the serializer correctly?
 
thanks,
Greg. 
 

Reply via email to