Last post Jan 24, 2011 02:31 AM by decker dong - msft
Jan 21, 2011 03:10 PM|rareddy|LINK
Now, I'm not talking about the whitespace between elements, I'm talking about the whitespace in the data.
So the XmlReader settings to handle whitespace does NOT apply here!
<element>this is me </element>
When I serialize and deserialize, I want it to be
<element>this is me</element>
Any way to easily do this? tia.
Jan 21, 2011 03:26 PM|SGWellens|LINK
When you serialize and deserialize an object, the original object should be recreated.
What you are asking for is how to change xml data.
Jan 22, 2011 08:22 PM|Decker Dong - MSFT|LINK
Well, please use File.ReadAllLines to read out the whole XML and use string's method(replace(" ","")). to remove all the blank symbols
and resave to the same file referring File.WriteAllLines.
Jan 23, 2011 11:14 AM|mbanavige|LINK
decker dong - msft
read out the whole XML and use string's method(replace(" ","")). to remove all the blank symbols
I think this would result in a corrupt xml file. Some spaces need to be retained in order for the xml to be valid.
for example, consider this smalll xml fragment
removing all spaces from the underlying xml file would result in
trimming up spaces on elements or attributes is something i think you'll need to attend to on the individual element/attribute values.
Jan 24, 2011 02:31 AM|Decker Dong - MSFT|LINK
Sorry, I've only considered part of that. Thx MVP!