Exemplo n.º 1
0
        public void SequenceOfScalarsToXml()
        {
            YamlDocument yaml = GetDocument("test8.yaml");

            XmlConverter converter = new XmlConverter();
            XmlDocument xml = converter.ToXml(yaml);

            xml.Save(Console.Out);
        }
Exemplo n.º 2
0
        public void Roundtrip()
        {
            var yaml = GetDocument("test10.yaml");

            var converter = new XmlConverter();
            var xml = converter.ToXml(yaml);

            var firstBuffer = new StringWriter();
            xml.Save(firstBuffer);
            Dump.Write(firstBuffer);

            var intermediate = converter.FromXml(xml);
            var final = converter.ToXml(intermediate);

            var secondBuffer = new StringWriter();
            final.Save(secondBuffer);
            Dump.Write(secondBuffer);

            Assert.Equal(firstBuffer.ToString(), secondBuffer.ToString());
        }
Exemplo n.º 3
0
        public void Roundtrip()
        {
            YamlDocument yaml = GetDocument("test10.yaml");

            XmlConverter converter = new XmlConverter();
            XmlDocument xml = converter.ToXml(yaml);

            StringWriter firstBuffer = new StringWriter();
            xml.Save(firstBuffer);
            Console.Out.Write(firstBuffer.ToString());

            YamlDocument intermediate = converter.FromXml(xml);
            XmlDocument final = converter.ToXml(intermediate);

            StringWriter secondBuffer = new StringWriter();
            final.Save(secondBuffer);
            Console.Error.Write(secondBuffer.ToString());

            Assert.AreEqual(firstBuffer.ToString(), secondBuffer.ToString(), "The first and second XML are different.");
        }
Exemplo n.º 4
0
 /// <summary>
 /// Invokes <see cref="XmlConverter.ToXml"/>.
 /// </summary>
 public static XmlDocument ToXml(this YamlDocument document)
 {
     XmlConverter converter = new XmlConverter();
     return converter.ToXml(document);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Invokes <see cref="XmlConverter.ToXml"/>.
 /// </summary>
 public static XmlDocument ToXml(this YamlDocument document, XmlConverterOptions options)
 {
     XmlConverter converter = new XmlConverter(options);
     return converter.ToXml(document);
 }