Exemple #1
0
        public void NodeValue_equals_entire_content_excluding_target()
        {
            DomDocument doc = new DomDocument();
            var         pi  = doc.CreateProcessingInstruction("hello", "world");

            Assert.Equal("world", pi.NodeValue);
        }
Exemple #2
0
        public void NodeName_equals_target()
        {
            DomDocument doc = new DomDocument();
            var         pi  = doc.CreateProcessingInstruction("hello", "world");

            Assert.Equal("hello", pi.NodeName);
        }
 public void test_created_node_not_in_document_has_owner()
 {
     DomDocument doc = new DomDocument();
     var pi = doc.CreateProcessingInstruction("hello", "world");
     Assert.That(pi.ParentNode, Is.Null);
     Assert.That(pi.ParentElement, Is.Null);
     Assert.That(pi.OwnerDocument, Is.EqualTo(doc));
 }
Exemple #4
0
        public void CreateProcessingInstruction_node_not_in_document_has_owner()
        {
            DomDocument doc = new DomDocument();
            var         pi  = doc.CreateProcessingInstruction("hello", "world");

            Assert.Null(pi.ParentNode);
            Assert.Null(pi.ParentElement);
            Assert.Equal(doc, pi.OwnerDocument);
        }
Exemple #5
0
        public void Clone_will_clone_annotations_copied_to_new_node()
        {
            var doc = new DomDocument();

            var node  = doc.CreateProcessingInstruction("a").AddAnnotation(new object());
            var clone = node.Clone();

            Assert.HasCount(1, clone.AnnotationList.OfType <object>());
        }
 public void test_create_processing_instruction_nominal()
 {
     DomDocument doc = new DomDocument();
     var pi = doc.CreateProcessingInstruction("hello", "world");
     Assert.That(pi.TextContent, Is.EqualTo("world"));
     Assert.That(pi.Data, Is.EqualTo("world"));
     Assert.That(pi.Target, Is.EqualTo("hello"));
     Assert.That(pi.NodeValue, Is.EqualTo("world"));
     Assert.That(pi.Prefix, Is.Null);
     Assert.That(pi.LocalName, Is.Null);
     Assert.That(pi.NamespaceUri, Is.Null);
     Assert.That(pi.NodeName, Is.EqualTo("hello"));
     Assert.That(pi.ChildNodes.Count, Is.EqualTo(0));
     Assert.That(pi.NodeType, Is.EqualTo((DomNodeType) 7));
 }
        public void construct_generic_dom_document_processing_factory()
        {
            DomDocument d = new DomDocument();
            var xml = d.CreateProcessingInstruction("xml");
            xml.AppendData("version=\"1.0\" standalone=\"yes\"");
            var html = d.CreateElement("html");
            var body = d.CreateElement("body");
            var p = d.CreateElement("p");
            var text = d.CreateText("Hello, World");

            p.Append(text);

            d.Append(html);
            body.Append(p).AppendTo(html);
        }
        internal static HtmlProcessingInstruction FromFullContent(DomDocument doc, string text)
        {
            string[] results = split.Split(text, 2);

            if (results.Length < 2)
            {
                Array.Resize(ref results, 2);
                results[1] = string.Empty;
            }

            results[0] = results[0].Trim();
            results[1] = results[1].Trim();
            var pi = (HtmlProcessingInstruction)doc.CreateProcessingInstruction(results[0]);

            pi.Data = results[1];
            return(pi);
        }
Exemple #9
0
        public void CreateProcessingInstruction_nominal()
        {
            DomDocument doc = new DomDocument();
            var         pi  = doc.CreateProcessingInstruction("hello", "world");

            Assert.Equal("world", pi.TextContent);
            Assert.Equal("world", pi.Data);
            Assert.Equal("hello", pi.Target);
            Assert.Equal("world", pi.NodeValue);
            Assert.Null(pi.Prefix);
            Assert.Null(pi.LocalName);
            Assert.Null(pi.NamespaceUri);
            Assert.Null(pi.Name);
            Assert.Equal("hello", pi.NodeName);
            Assert.Equal(0, pi.ChildNodes.Count);
            Assert.Equal((DomNodeType)7, pi.NodeType);
            Assert.Null(pi.InnerText);
        }