StAX XML formatting in Java

前端 未结 10 1421
-上瘾入骨i
-上瘾入骨i 2020-11-29 08:06

Is it possible using StAX (specifically woodstox) to format the output xml with newlines and tabs, i.e. in the form:


  
   someData
  &         


        
10条回答
  •  青春惊慌失措
    2020-11-29 08:59

    There is com.sun.xml.txw2.output.IndentingXMLStreamWriter

    XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
    XMLStreamWriter writer = new IndentingXMLStreamWriter(xmlof.createXMLStreamWriter(out));
    

提交回复
热议问题