是否和放大器;放大器;算一个或多个字符在XML文件? [英] Does & count as one or multiple chars in an xml file?
问题描述
XML模式我正在与有特定的字符长度的字符串。所以,我可能有一个字符串,它是这样的:
The XML schema I'm working with has specific character lengths for strings. So I may have a string that's like:
吉姆&放大器;玛丽
这是10个字符在C#中,但是当它被写入到XML从而将其变为:
which is 10 chars in C# but when it is written to xml it becomes:
吉姆&放大器;放大器;玛丽
如果XML模式表示,该字符串只可能是一个最大的10个字符。请问这个字符串传递?
If an XML schema said the string could only be a max of 10 chars. Would this string pass?
如果没有,我怎么可以测试在C#中的字符串的长度,因为它会出现在XML?
If not, how can I test in C# for the string length as it would appear in XML?
感谢您的帮助。
推荐答案
我得出同样的结论马特(&放大器;放大器;
是一个字符),但基于上的标准。该 XML标准指出的在的验证,属性值必须被归一化,其包括实体替换
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".
这篇关于是否和放大器;放大器;算一个或多个字符在XML文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!