public ToXml ( |
||
ownerDocument | The |
|
return |
/// <summary> /// Renders the exception to the specified <paramref name="writer"/> /// </summary> /// <param name="writer">The writer to render the exception to.</param> /// <param name="context">The context under which this code is executing.</param> public virtual void Render(TextWriter writer, SageContext context) { Contract.Requires<ArgumentNullException>(context != null); Contract.Requires<ArgumentNullException>(writer != null); XmlDocument document = new XmlDocument(); XmlElement documentElement = document.AppendElement(this.ConvertToXml(this.Exception, document)); Exception inner = this.Exception.InnerException; while (inner != null) { documentElement.AppendChild(this.ConvertToXml(inner, document)); inner = inner.InnerException; } documentElement.AppendChild(context.ToXml(document)); documentElement.SetAttribute("date", DateTime.Now.ToString("dd-MM-yyyy")); documentElement.SetAttribute("time", DateTime.Now.ToString("hh:mm:ss")); XsltTransform processor = XsltTransform.Create(context, this.StylesheetPath); XmlWriter xmlwr = XmlWriter.Create(writer, processor.OutputSettings); processor.Transform(documentElement, xmlwr, context, this.GetTransformArguments(context)); }