/// <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); }
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)"); } }
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); } }
private static string ShortDescriptionXmlHeader(XmlHeaderNode node) => "<?xml>";
private static string LongDescriptionXmlHeader(XmlHeaderNode node) => string.Empty;