Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dom4j new lines

 
Cristian Popovici
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

Is it possible to add a new line after each attribute of a node with dom4j, just to get the attributes one under another in my xml source?

Regards,
Cristian.
 
Pavel Cherkashin
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Cristian. It seems that Dom4j does not handle new lines after every attribute. But it does handle formatted output.


refer org.dom4j.io.OutputFormat
for the more detailed information about formatting possibilities the Dom4j provide.
To reach the thing You need, it might be helpful to reload some methods in
org.dom4j.io.XMLWriter

Or the other way to solve the problem - is to output the XML content into string buffer and then add some format refinements using regular expressions.
[ February 28, 2008: Message edited by: Pavel Cherkashin ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic