private void WriteData(object data) {
XPathNavigator xmlBlob = data as XPathNavigator;
if(xmlBlob == null)
WriteEscaped(data.ToString());
else {
if (strBldr == null) {
strBldr = new StringBuilder();
xmlBlobWriter = new XmlTextWriter(new StringWriter(strBldr, CultureInfo.CurrentCulture));
}
else
strBldr.Length = 0;
try {
// Rewind the blob to point to the root, this is needed to support multiple XMLTL in one TraceData call
xmlBlob.MoveToRoot();
xmlBlobWriter.WriteNode(xmlBlob, false);
InternalWrite(strBldr.ToString());
}
catch (Exception) { // We probably only care about XmlException for ill-formed XML though
InternalWrite(data.ToString());
}
}
}