The XML schema I’m working with has specific character lengths for strings. So I may have a string that’s like:
"Jim & Mary"
which is 10 chars in C# but when it is written to xml it becomes:
"Jim & Mary"
If an XML schema said the string could only be a max of 10 chars. Would this string pass?
If not, how can I test in C# for the string length as it would appear in XML?
Thanks for any help.
I reach the same conclusion as Matt (
&is a single character), but based on the standards. The XML standard states that before validation, attribute values must be normalized, which includes entity replacement.Also see the Treatment of Entities section, which states that they would be “Included” whether they were part of content or inside attribute values. “Included” has this meaning: “its replacement text is retrieved and processed, in place of the reference itself, as though it were part of the document at the location the reference was recognized”.