private async Task WriteEndAttributeAsyncImpl()
{
await FlushBase64Async().ConfigureAwait(false);
try
{
if (_isXmlAttribute)
{
if (_attributeLocalName == "lang")
{
_nsMgr.AddLangAttribute(_attributeValue);
}
else if (_attributeLocalName == "space")
{
if (_attributeValue == "preserve")
{
_nsMgr.AddSpaceAttribute(XmlSpace.Preserve);
}
else if (_attributeValue == "default")
{
_nsMgr.AddSpaceAttribute(XmlSpace.Default);
}
else
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.XmlInvalidXmlSpace, _attributeValue)));
}
}
else
{
// XmlTextWriter specifically allows for other localNames
}
_isXmlAttribute = false;
_attributeLocalName = null;
_attributeValue = null;
}
if (_isXmlnsAttribute)
{
_nsMgr.AddNamespaceIfNotDeclared(_attributeLocalName, _attributeValue, null);
_isXmlnsAttribute = false;
_attributeLocalName = null;
_attributeValue = null;
}
else
{
await _writer.WriteEndAttributeAsync().ConfigureAwait(false);
}
}
finally
{
_writeState = WriteState.Element;
}
}