HighTechTalks DotNet Forums  

Whitespaces inside elements

Dotnet XML microsoft.public.dotnet.xml


Discuss Whitespaces inside elements in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Magnus Nilsson
 
Posts: n/a

Default Whitespaces inside elements - 12-14-2007 , 09:33 AM






Hi!

Is there any way of preserving whitespaces inside nodes, e.g. line breaks,
when using XmlDocuments? If I for example have a string with the following
content:
<root>
<wot
id="1"
name="wot1">
</wot>
</root>

and loads it into XmlDocument, with PreserveWhitespace set to true, the line
breaks inside <wot> will disappear when I output the xml to a string. Can
this be avoided?

Best regards,
Magnus



Reply With Quote
  #2  
Old   
Magnus Nilsson
 
Posts: n/a

Default RE: Whitespaces inside elements - 12-14-2007 , 09:36 AM






Hrm, that wasn't very pretty. Preview page, perhaps?

Please press reply on the original message to see a better formatted version..

"Magnus Nilsson" wrote:

Quote:
Hi!

Is there any way of preserving whitespaces inside nodes, e.g. line breaks,
when using XmlDocuments? If I for example have a string with the following
content:
root
wot
id="1"
name="wot1"
/wot
/root

and loads it into XmlDocument, with PreserveWhitespace set to true, the line
breaks inside <wot> will disappear when I output the xml to a string. Can
this be avoided?

Best regards,
Magnus



Reply With Quote
  #3  
Old   
Martin Honnen
 
Posts: n/a

Default Re: Whitespaces inside elements - 12-14-2007 , 09:57 AM



Magnus Nilsson wrote:
Quote:
Hi!

Is there any way of preserving whitespaces inside nodes, e.g. line breaks,
when using XmlDocuments? If I for example have a string with the following
content:
root
wot
id="1"
name="wot1"
/wot
/root

and loads it into XmlDocument, with PreserveWhitespace set to true, the line
breaks inside <wot> will disappear when I output the xml to a string. Can
this be avoided?
The line break inside the wot element e.g. the
<wot>
</wot>
should be preserved. I don't think there is a way to preserve the line
breaks inside the start tag i.e. the line breaks that separate the
attributes.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Reply With Quote
  #4  
Old   
Magnus Nilsson
 
Posts: n/a

Default Re: Whitespaces inside elements - 12-17-2007 , 01:52 AM



Ouch. Thanks Martin, much appreciated.

"Martin Honnen" wrote:

Quote:
Magnus Nilsson wrote:
Hi!

Is there any way of preserving whitespaces inside nodes, e.g. line breaks,
when using XmlDocuments? If I for example have a string with the following
content:
root
wot
id="1"
name="wot1"
/wot
/root

and loads it into XmlDocument, with PreserveWhitespace set to true, the line
breaks inside <wot> will disappear when I output the xml to a string. Can
this be avoided?

The line break inside the wot element e.g. the
wot
/wot
should be preserved. I don't think there is a way to preserve the line
breaks inside the start tag i.e. the line breaks that separate the
attributes.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.