I write the XML file "manually" (ie not with LINQ to XML), which sometimes includes an open / close tag containing one whitespace character. When viewing the resulting file, everything looks correct, example below ...
<Item> <ItemNumber>3</ItemNumber> <English> </English> <Translation>Ignore this one. Do not remove.</Translation> </Item>
... the reasons for this are different and irrelevant, this is being done.
Later, I use the C # program with LINQ to XML to read the file and extract the record ...
XElement X_EnglishE = null; // This is CRAZY foreach (XElement i in Records) { X_EnglishE = i.Element("English"); // There is only one damned record! } string X_English = X_EnglishE.ToString();
... and check that it does not change from the database record. I detect a change in processing elements in which the field has a single space ...
+E+ Text[3] English source has been altered: Was: >>> <<< Now: >>><<<
... β> and <the parts that I added to see what happens (it's hard to see the space characters). I was busy with this, but I donβt understand why this is so. This is not entirely important as the field is not used (yet), but I cannot trust C # or LINQ or what does this if I do not understand why this is so. So what does this do and why?
source share