コード例 #1
0
            private bool TryParseDoctype()
            {
                int doctypeStartIndex = currentIndex;
                int doctypeEndIndex   = -1;

                while (ReadNext())
                {
                    if (currentChar == '>')
                    {
                        doctypeEndIndex = currentIndex - 1;
                        break;
                    }
                }
                if (doctypeEndIndex == -1)
                {
                    // No end of doctype found, e.g. "<!DOCTYPE html"
                    parseError = HtmlParseError.NodeNotClosed;
                    return(false);
                }
                string doctypeString = text.Substring(doctypeStartIndex, doctypeEndIndex - doctypeStartIndex + 1);

                doctype = new HtmlDoctype(doctypeString);
                ReadAndSkipWhitespace();
                return(true);
            }
コード例 #2
0
 public HtmlDocument() : base("html")
 {
     Doctype = new HtmlDoctype(HtmlDoctypeType.Html5);
 }