Beispiel #1
0
        public void StripCommentsAtDifferentLevels(string xsltVersion)
        {
            CommentLessSource cls = GetSource("<?xml version='1.0'?>"
                                              + "<!-- comment 1 -->"
                                              + "<foo>"
                                              + "<!-- comment 2 -->"
                                              + "</foo>", xsltVersion);
            XmlDocument d = Org.XmlUnit.Util.Convert.ToDocument(cls);

            Assert.AreEqual(2, d.ChildNodes.Count);
            Assert.IsTrue(d.ChildNodes[0] is XmlDeclaration);
            Assert.IsTrue(d.ChildNodes[1] is XmlElement);
            Assert.AreEqual(0, d.ChildNodes[1].ChildNodes.Count);
        }
Beispiel #2
0
        public void StripCommentsAtDifferentLevels()
        {
            StreamSource s =
                new StreamSource(new StringReader("<?xml version='1.0'?>"
                                                  + "<!-- comment 1 -->"
                                                  + "<foo>"
                                                  + "<!-- comment 2 -->"
                                                  + "</foo>"));
            CommentLessSource cls = new CommentLessSource(s);
            XmlDocument       d   = Org.XmlUnit.Util.Convert.ToDocument(cls);

            Assert.AreEqual(2, d.ChildNodes.Count);
            Assert.IsTrue(d.ChildNodes[0] is XmlDeclaration);
            Assert.IsTrue(d.ChildNodes[1] is XmlElement);
            Assert.AreEqual(0, d.ChildNodes[1].ChildNodes.Count);
        }