Ejemplo n.º 1
0
        private CommentLessSource GetSource(string s, string xsltVersion)
        {
            StreamSource src = s == null ? null : new StreamSource(new StringReader(s));

            return(xsltVersion == null ? new CommentLessSource(src)
                : new CommentLessSource(src, xsltVersion));
        }
Ejemplo n.º 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);
        }