What do I need to do either in my C # code or in my XML document so that the XDocument parser reads literal spaces for Value from XElement s?
BackgroundI have an XML document, part of which is as follows:
<NewLineString> </NewLineString> <IndentString> </IndentString>
I add the values โโof each XElement to the data dictionary using the LINQ query; The .ForEach part is as follows:
.ForEach(x => SchemaDictionary.Add( LogicHelper.GetEnumValue(x.Name.ToString()), x.Value));
To check if spaces are saved, I print a string of character numbers for each value item in the data dictionary. In the following code, x represents a KeyValuePair , and Aggregate just creates a string of integer character values:
x.Value.ToCharArray() .Aggregate<char,string>("",(word,c) => word + ((int)c).ToString() + " " ) ));
I expected to see 10 13 for the value of <NewLineString> and 32 32 32 32 for the value of <IndentString> . However, nothing was printed for each value (note: other XML escape values, such as < correctly printed their character numbers).
What do I need to do either in C # code or in my XML document so that my parser adds a full space string to the data dictionary?
Ben mccormack
source share