public void DocumentParsingEventHandler(object sender, DocumentParsingEventArgs e)
 {
     XElement html = e.Document.Root;
     XElement head = html.Element("head");
     Check.NotNull(head, "<head> section is missing from document");
     XElement style = new XElement("style");
     style.SetValue(StylesheetContent);
     head.AddFirst(style);
 } 
Exemplo n.º 2
0
        public void DocumentParsingEventHandler(object sender, DocumentParsingEventArgs e)
        {
            XElement html = e.Document.Root;
            XElement head = html.Element("head");

            Check.NotNull(head, "<head> section is missing from document");
            XElement style = new XElement("style");

            style.SetValue(StylesheetContent);
            head.AddFirst(style);
        }
        public void DocumentParsingEventHandler(object sender, DocumentParsingEventArgs e)
        {
            XElement html = e.Document.Root;
            Check.IsTrue("html".Equals(html.Name.LocalName),
                    "Only <html> documents are supported (<" + html.Name.LocalName + "> is not)");

            if (!HasHeadSection(html))
            {
                XElement head = new XElement("head");
                CopyNodesBeforeBodyIntoHead(html, head);
                html.AddFirst(head);
            }
        }
Exemplo n.º 4
0
        public void DocumentParsingEventHandler(object sender, DocumentParsingEventArgs e)
        {
            XElement html = e.Document.Root;

            Check.IsTrue("html".Equals(html.Name.LocalName),
                         "Only <html> documents are supported (<" + html.Name.LocalName + "> is not)");

            if (!HasHeadSection(html))
            {
                XElement head = new XElement("head");
                CopyNodesBeforeBodyIntoHead(html, head);
                html.AddFirst(head);
            }
        }