• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing new line character in DOM

 
Luqman Qaiser
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Luqman Qaiser
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried exactly what u suggested, But not working...

Kindly Help.
 
Dave Lenton
Ranch Hand
Posts: 1241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic