Beispiel #1
0
        public void Transform(Stream input, string xsltFilePath, Stream output)
        {
            var destination = new TextWriterDestination(XmlWriter.Create(output))
            {
                CloseAfterUse = true
            };

            Transform(_documentBuilder.Value.Build(input), xsltFilePath, destination);
        }
Beispiel #2
0
        public void Validate(string validationXsltPath, XmlDocument xmlDocumentToValidate, XmlDocument resultDocument)
        {
            var input = _documentBuilder.Value.Build(xmlDocumentToValidate);

            using (var stream = new MemoryStream())
            {
                var destination = new TextWriterDestination(XmlWriter.Create(stream))
                {
                    CloseAfterUse = true
                };
                Transform(input, validationXsltPath, destination);

                stream.Position = 0;
                resultDocument.Load(stream);
            }
        }
Beispiel #3
0
        public static TextWriterDestination CreateFileOutput(string fileName)
        {
            var fs = File.Open(Path.Combine(TestContext.CurrentContext.TestDirectory, fileName),
                               FileMode.Create);
            var settings = new XmlWriterSettings
            {
                CloseOutput        = true,
                Indent             = true,
                OmitXmlDeclaration = true,
            };
            var xmlWriter = XmlWriter.Create(new StreamWriter(fs), settings);

            var res = new TextWriterDestination(xmlWriter)
            {
                CloseAfterUse = true
            };

            return(res);
        }
Beispiel #4
0
        public void Transform(XmlReader input, string xsltFilePath, XmlWriter output)
        {
            var destination = new TextWriterDestination(XmlWriter.Create(output));

            Transform(_documentBuilder.Value.Build(input), xsltFilePath, destination);
        }
Beispiel #5
0
        public override void Run(XmlWriter output, XsltRuntimeOptions options)
        {
            XmlDestination builder = new TextWriterDestination(output);

            Run(builder, options);
        }