• Post Reply Bookmark Topic Watch Topic
  • New Topic

Write enter/indent with java inside xml file  RSS feed

 
Hesham Gneady
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers ,

I am trying to edit an xml file using java, my only problem is that all data written appears in the xml file in 1 line.


Here is my java code :

I saw some answers saying i can do this using the Transformer class. Do i have to change my code now, or is there a way i can do this here ?

Thanks ,


 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the second example here: http://faq.javaranch.com/java/HowToPrettyPrintXmlWithJava
 
Hesham Gneady
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Ulf ... That was quite clear.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!