• Post Reply Bookmark Topic Watch Topic
  • New Topic

XMLStreamException when writing a XML file  RSS feed

 
Andre Peixoto
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before I was using this code to write an XML file using StAX:


This code was working fine but now it throws me an
javax.xml.stream.XMLStreamException: Trying to write multiple DOCTYPE declarations exception.


When debugging the application, I am able to see that the exception is thrown when I call the second time: eventWriter.add(end);

Why this code was working before and now it isn't?

The only modification that I made that could be a problem is that I added libraries to the project to use Axis2 Web Services (one of them is: geronimo-stax-api_1.0_spec-1.0.1.jar)... And I saw this:

Speed - Axis2 uses its own object model and StAX (Streaming API for XML) parsing to achieve significantly greater speed than earlier versions of Apache Axis.


And this:

stax-api-1.0.1.jar (The StAX API's that contain the javax.xml.namespace.QName class. This jar may be replaced by any other jar that contains the javax.xml.namespace.QName implementation. However Axis2 uses this class from the stax-api-1.0.1.jar which comes bundled with the Axis2 distribution)


Is that a compatibilty issue?
 
Andre Peixoto
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is solved!

Instead of using createDTD("\n"), I used createSpace("\n")...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!