/// <summary> /// Translates a response <see cref="Message"/>-derived message's body, whose content is given by <paramref /// name="reader"/>, and outputs the results to <paramref name="writer"/>. /// </summary> /// <param name="reader"> /// The <see cref="XmlReader"/> containing the input document. /// </param> /// <param name="writer"> /// The <see cref="XmlWriter"/> that will contain the output of the transform. /// </param> /// <remarks> /// It wraps both the original <see cref="XmlMessage"/>-derived request's <see cref="XmlReader"/> and the <see /// cref="Message"/> response's <see cref="XmlReader"/> in a <see cref="CompositeXmlReader"/> before applying the /// <typeparamref name="TResponseTransform"/> transform. /// </remarks> protected override void TranslateResponse(XmlReader reader, XmlWriter writer) { using (var requestBodyReader = _xmlRequest.GetReaderAtContent()) using (var compositeReader = CompositeXmlReader.Create(new[] { requestBodyReader, reader })) { base.TranslateResponse(compositeReader, writer); } }
/// <summary> /// Executes the transform using a compound of <see cref="Stream"/>s as input document specified and outputs the results /// to an <see cref="XmlWriter"/>. The <paramref name="streams"/> compound will be aggregated in a composite XML structure /// by the <see cref="CompositeXmlReader"/>. /// </summary> /// <param name="this"> /// The <see cref="XslCompiledTransform"/> transform to execute. /// </param> /// <param name="streams"> /// The input <see cref="Stream"/> compound. /// </param> /// <param name="arguments"> /// An <see cref="XsltArgumentList"/> containing the namespace-qualified arguments used as input to the transform. /// </param> /// <param name="writer"> /// The <see cref="XmlWriter"/> to which to output. /// </param> /// <seealso cref="CompositeXmlReader"/> internal static void Transform(this XslCompiledTransform @this, IEnumerable <Stream> streams, XsltArgumentList arguments, XmlWriter writer) { using (var xmlReader = CompositeXmlReader.Create(streams, new XmlReaderSettings { CloseInput = true })) { @this.Transform(xmlReader, arguments, writer); } }