What is the shortest way to pretty print a org.w3c.dom.Document to stdout?

前端 未结 6 1388
难免孤独
难免孤独 2020-11-27 11:08

What is the easiest way to pretty print (a.k.a. formatted) a org.w3c.dom.Document to stdout?

6条回答
  •  無奈伤痛
    2020-11-27 11:41

    Try jcabi-xml with one liner:

    String xml = new XMLDocument(document).toString();
    

    This is the dependency you need:

    
      com.jcabi
      jcabi-xml
      0.14
    
    

提交回复
热议问题