Пример #1
0
        /// <summary>
        /// Parses an XML header tag. Assumes current position is just after tag name.
        /// </summary>
        /// <param name="parser">Parser object.</param>
        private XmlHeaderNode ParseXmlHeader(TextParser parser)
        {
            XmlHeaderNode node   = new XmlHeaderNode(ParseAttributes(parser));
            string        tagEnd = "?>";

            parser.MoveTo(tagEnd);
            parser.MoveAhead(tagEnd.Length);
            return(node);
        }
Пример #2
0
 private static void PopulatePropertiesXmlHeader(XmlHeaderNode node, ListView listView)
 {
     InitializeListView(AttributeColumns, listView);
     foreach (var att in node.Attributes)
     {
         var item = listView.Items.Add(att.Key);
         item.SubItems.Add(att.Value != null ? att.Value.Value : "(null)");
     }
 }
Пример #3
0
        public void TestXmlHeader()
        {
            List <Attribute>[] xmlHeaders = new List <Attribute>[]
            {
                new List <Attribute> {
                    new Attribute("version", "1.0")
                },
                new List <Attribute> {
                    new Attribute("version", "1.0"),
                    new Attribute("encoding", "UTF-8"),
                    new Attribute("standalone", "no"),
                },
            };

            foreach (List <Attribute> attributes in xmlHeaders)
            {
                string             header   = string.Format($"<?xml {string.Join(" ", attributes)}?>");
                HtmlMonkeyDocument document = HtmlMonkeyDocument.FromHtml(header);
                Assert.AreEqual(1, document.RootNodes.Count);
                XmlHeaderNode node = document.RootNodes[0] as XmlHeaderNode;
                Assert.AreNotEqual(null, node);
                Attribute.CompareAttributes(attributes, node.Attributes);
            }
        }
Пример #4
0
 private static string ShortDescriptionXmlHeader(XmlHeaderNode node) => "<?xml>";
Пример #5
0
 private static string LongDescriptionXmlHeader(XmlHeaderNode node) => string.Empty;