public void NodeValue_is_null()
        {
            DomDocument doc = new DomDocument();
            var         dd  = doc.CreateDocumentType("html");

            Assert.Null(dd.NodeValue);
        }
        public void OuterXml_is_expected_value()
        {
            DomDocument doc = new DomDocument();
            var         dd  = doc.CreateDocumentType("html", "public", "system");

            Assert.Equal("<!DOCTYPE html PUBLIC \"public\" \"system\">", dd.OuterXml);
        }
        public void NodeName_is_same_as_name()
        {
            DomDocument doc = new DomDocument();
            var         dd  = doc.CreateDocumentType("html");

            Assert.Equal("html", dd.NodeName);
        }
        public void Clone_will_clone_annotations_copied_to_new_node()
        {
            var doc = new DomDocument();

            var node  = doc.CreateDocumentType("html").AddAnnotation(new object());
            var clone = node.Clone();

            Assert.HasCount(1, clone.AnnotationList.OfType <object>());
        }
示例#5
0
        public void Doctype_should_get_the_document_type()
        {
            var doc = new DomDocument();
            var dt  = doc.CreateDocumentType("html");

            dt.AppendTo(doc);
            doc.AppendText(" ");
            Assert.Same(dt, doc.Doctype);
        }
 public void test_append_multiple_noncontent_nodes()
 {
     DomDocument doc = new DomDocument();
     var docType = doc.CreateDocumentType("html");
     var ws = doc.CreateComment("time");
     var html = doc.CreateElement("html");
     doc.Append(docType, ws, html);
     Assert.That(doc.DocumentElement, Is.SameAs(html));
     Assert.That(doc.ChildNodes.Count, Is.EqualTo(3));
 }
示例#7
0
        public void Append_should_append_multiple_noncontent_nodes()
        {
            DomDocument doc     = new DomDocument();
            var         docType = doc.CreateDocumentType("html");
            var         ws      = doc.CreateComment("time");
            var         html    = doc.CreateElement("html");

            doc.Append(docType, ws, html);
            Assert.Same(html, doc.DocumentElement);
            Assert.Equal(3, doc.ChildNodes.Count);
        }
        /// <summary>
        /// Appends a doctype node to the document.
        /// </summary>
        ///
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="fpi">
        /// The formal public identifier
        /// </param>
        /// <param name="uri">
        /// The URI
        /// </param>

        protected override void AppendDoctypeToDocument(string name, string fpi, string uri)
        {
            var doctype = Document.CreateDocumentType(name, "PUBLIC", fpi, uri);

            Document.AppendChildUnsafe(doctype);
        }
示例#9
0
        /// <summary>
        /// Appends a doctype node to the document.
        /// </summary>
        ///
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="publicIdentifier">
        /// DocType public identifier
        /// </param>
        /// <param name="systemIdentifier">
        /// DocType system identifier.
        /// </param>

        protected override void AppendDoctypeToDocument(string name, string publicIdentifier, string systemIdentifier)
        {
            var doctype = Document.CreateDocumentType(name, publicIdentifier, systemIdentifier);

            Document.AppendChildUnsafe(doctype);
        }