if(null == handler)
{
String method = format.getMethod();
org.apache.xml.serialize.SerializerFactory factory = org.apache.xml.serialize.SerializerFactory.getSerializerFactory(method);
org.apache.xml.serialize.Serializer serializer = factory.makeSerializer(writer, format);
handler = serializer.asDocumentHandler();
}
return handler;
}