dom4j HTMLWriter missing XML declaration

syphaxe

New Member
The dom4j 1.6.1 HTMLWriter is missing an XML declaration even if set to XHTML mode.It is fixed by changing back to XMLWriter but then I'm missing all the HTML features.\[code\] import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.io.HTMLWriter; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; OutputFormat format = new OutputFormat(); format.setEncoding("UTF-8"); format.setXHTML(true); format.setOmitEncoding(false); format.setSuppressDeclaration(false); HTMLWriter writer = null; try { writer = new HTMLWriter(format); } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { writer.write(createDocument()); writer.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }\[/code\]
 
Back
Top