aspose file tools
The moose likes XML and Related Technologies and the fly likes Writing new line character in DOM Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Writing new line character in DOM" Watch "Writing new line character in DOM" New topic
Author

Writing new line character in DOM

Luqman Qaiser
Greenhorn

Joined: Aug 21, 2005
Posts: 18
Hi,
How to write a new line character after any node in DOM.

for e.g.
if the DOM structure is
<ROOT>
<FIRSTNAME>Mahesh</FIRSTNAME><LASTNAME>Kumar</LASTNAME>
</ROOT>

How to change it to this below form

<ROOT>
<FIRSTNAME>Mahesh</FIRSTNAME>
<LASTNAME>Kumar</LASTNAME>
</ROOT>

Thanks,
Lucky
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12271
    
    1
How to write a new line character after any node in DOM.

As far as XML is concerned, what you are talking about is a Node of type TEXT_NODE that has a content of a newline character sequence.
In your example, it would be a child of the ROOT element.

Incidently, you should go change your name to fit the JavaRanch name policy.
Bill


Java Resources at www.wbrogden.com
Luqman Qaiser
Greenhorn

Joined: Aug 21, 2005
Posts: 18
I have tried exactly what u suggested, But not working...

Kindly Help.
Dave Lenton
Ranch Hand

Joined: Jan 20, 2005
Posts: 1241
Here is everything one will ever want to know about whitespace in XSLT, even the sickest of questions that one can come up with in the most depraved of ones XSLT-whitespace related fantasies.


There will be glitches in my transition from being a saloon bar sage to a world statesman. - Tony Banks
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Writing new line character in DOM
 
Similar Threads
State Exception
Java Web Services 2
Getting "Unable to compile class for JSP" error
Problem with xml file
XML Parsing help needed