• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Writing new line character in DOM

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried exactly what u suggested, But not working...

Kindly Help.
 
Ranch Hand
Posts: 1241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic