How to indent XML properly using XMLSerializer?

前端 未结 4 1311
野性不改
野性不改 2021-02-07 14:39

I\'m having a hard time trying to indent XML files using XMLSerializer.

I\'ve tried

serializer.setFeature(\"http://xmlpull.org/v1/doc/featur         


        
4条回答
  •  无人共我
    2021-02-07 14:57

    I just wanted to make a note that Transformer.setOutputProperties(Properties) doesn't seems to work for me (1.6.0_26_b03), but Transformer.setOutputProperty(String,String) does perfectly.
    If you have a Properties object, you might have to iterate and individually set the output property for it to work.

提交回复
热议问题