This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Dom4j new lines Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Dom4j new lines" Watch "Dom4j new lines" New topic
Author

Dom4j new lines

Cristian Popovici
Ranch Hand

Joined: Apr 13, 2007
Posts: 32
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

Joined: Mar 04, 2005
Posts: 47
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 ]

Pavel Cherkashin - <br />SCJP, SCWCD, SCDJWS, SCBCD, SCEA, ...<br />www.linkedin.com/in/pcherkas
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dom4j new lines
 
Similar Threads
Proper use of an EntityResolver
NoClassDefFoundError: org/dom4j/io/SAXReader
Creating New XML file from CDATA
Dom4j problem
Writing to XML file using DOM4j