public virtual string ReadOuterXml()
{
if (ReadState != ReadState.Interactive)
{
return string.Empty;
}
if ((this.NodeType != XmlNodeType.Attribute) && (this.NodeType != XmlNodeType.Element))
{
Read();
return string.Empty;
}
StringWriter sw = new StringWriter(CultureInfo.InvariantCulture);
XmlWriter xtw = CreateWriterForInnerOuterXml(sw);
try
{
if (this.NodeType == XmlNodeType.Attribute)
{
xtw.WriteStartAttribute(this.Prefix, this.LocalName, this.NamespaceURI);
WriteAttributeValue(xtw);
xtw.WriteEndAttribute();
}
else
{
xtw.WriteNode(this, false);
}
}
finally
{
xtw.Close();
}
return sw.ToString();
}