public override void WriteStartElement(string prefix, XmlDictionaryString localName)
{
int key;
if (!TryGetKey(localName, out key))
{
WriteStartElement(prefix, localName.Value);
}
else
{
if (prefix.Length == 0)
{
WriteNode(XmlBinaryNodeType.ShortDictionaryElement);
WriteDictionaryString(localName, key);
}
else
{
char ch = prefix[0];
if (prefix.Length == 1 && ch >= 'a' && ch <= 'z')
{
WritePrefixNode(XmlBinaryNodeType.PrefixDictionaryElementA, ch - 'a');
WriteDictionaryString(localName, key);
}
else
{
WriteNode(XmlBinaryNodeType.DictionaryElement);
WriteName(prefix);
WriteDictionaryString(localName, key);
}
}
}
}