how can i restore newlines in an element's attribute
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Saurabh_Jain
Posted On:   Friday, June 15, 2001 01:00 AM

hello,
i am facing a problem that when i store the contents of a textarea in my Xml file as the value of an attribute of an element and then later make a dom out of it and then display the string again in the text area ,all the newline charaters are removed by the Xml Dom.
but i want them back as it was formatted before sending to Xml. i can't change my Xml by using a textnode instead of attribute ,and use CDATA section ,since it is designed that way
i am using apache Xerces java parser for this
please respond with your valuable suggestions

Thank you

Saurabh

Re: how can i restore newlines in an element's attribute

Posted By:   Bozidar_Dangubic  
Posted On:   Friday, June 15, 2001 06:46 AM

you could encode your newlines as

I am still unsure about attributes having newlines and whether that is a good decision design-wise, but what I would do is take the value of the textarea and before store in xml encode all newlines as

That way, when you later read it out, newlines will be preserved. The

is for windows os. If you are in the Unix/Linux world then you can just encode newlines for unix/linux newlines.
About | Sitemap | Contact