Exemplo n.º 1
0
        private Node parseDoctype()
        {
            Token token = expect(typeof(Doctype))
            ;
            Doctype     doctype     = (Doctype)token;
            DoctypeNode doctypeNode = new DoctypeNode();

            doctypeNode.setValue(doctype.getValue());
            return(doctypeNode);
        }
Exemplo n.º 2
0
        /// <summary>
        /// doctype
        /// </summary>
        /// <returns></returns>
        private Doctype ParseDoctype()
        {
            var tok  = Expect("Doctype");
            var node = new Doctype(tok.Value)
            {
                Line = Line
            };

            return(node);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Renders doctype
        /// </summary>
        /// <param name="doctype">document type</param>
        /// <param name="writer">Destionation of rendering</param>
        public void RenderDocType(Doctype doctype, TextWriter writer)
        {
            var template = String.Empty;

            switch (doctype)
            {
            case Doctype.Html401Strict:
                template = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">";
                break;

            case Doctype.Html401Transitional:
                template = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
                break;

            case Doctype.Html401Frameset:
                template = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
                break;

            case Doctype.Xhtml10Strict:
                template = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
                break;

            case Doctype.Xhtml10Transitional:
                template = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                break;

            case Doctype.Xhtml10Frameset:
                template = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">";
                break;

            case Doctype.Xhtml11:
                template = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">";
                break;

            case Doctype.XhtmlBasic11:
                template = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.1//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd\">";
                break;

            case Doctype.Html5:
                template = "<!DOCTYPE HTML>";
                break;

            default:
                break;
            }
            writer.WriteLine(template);
        }
Exemplo n.º 4
0
 public virtual void WriteDoctype(Doctype doc)
 {
     WriteToken(doc.StartToken);
     WriteChildren(doc.Children);
     WriteToken(doc.EndToken);
     WriteNewLineAfter(doc.NewLineAfter);
 }
 /// <include file='doc\XhtmlMobileTextWriter.uex' path='docs/doc[@for="XhtmlMobileTextWriter.WriteDoctypeDeclaration"]/*' />
 public virtual void WriteDoctypeDeclaration (Doctype type){
     WriteLine((String)_doctypeDeclarations[type]);
 }
Exemplo n.º 6
0
 /// <include file='doc\XhtmlMobileTextWriter.uex' path='docs/doc[@for="XhtmlMobileTextWriter.WriteDoctypeDeclaration"]/*' />
 public virtual void WriteDoctypeDeclaration(Doctype type)
 {
     WriteLine((String)_doctypeDeclarations[type]);
 }
 public virtual void WriteDoctypeDeclaration(Doctype type)
 {
 }
Exemplo n.º 8
0
 public virtual bool ParseDoctype(Doctype d)
 {
     d.Clear();
     d.NewLineAfter.Value = string.Empty;
     var res = true;
     if (CurrentToken.Class == TokenClass.DoctypeStart) {
         d.StartToken.Read();
         var cl = CurrentToken.Class;
         while (cl != TokenClass.EndOfDocument &&
             (cl == TokenClass.Literal || cl == TokenClass.Identifier || cl == TokenClass.CDataStart || cl == TokenClass.String || cl == TokenClass.ServerTagStart)) {
             switch (cl) {
             case TokenClass.Identifier:
             case TokenClass.Literal:
             case TokenClass.CDataStart:
             case TokenClass.String:
                 var literal = d.Children.New<Literal>();
                 if (!ParseLiteral(literal, false)) res = false;
                 break;
             case TokenClass.ServerTagStart:
                 var serverTag = d.Children.New<ServerTag>();
                 if (!ParseServerTag(serverTag)) res = false;
                 break;
             }
             cl = CurrentToken.Class;
         }
         SkipTo(TokenClass.TagEnd, TokenClass.TagStart);
         if (CurrentToken.Class == TokenClass.TagEnd) {
             d.EndToken.Read();
             d.NewLineAfter.ReadNewLineAfter();
         } else {
             res = false;
             Error("Doctype: End tag expected.");
             d.EndToken.Class = TokenClass.TagEnd;
         }
     } else {
         res = false;
         Error("Doctype: Doctype start expected.");
         d.StartToken.Class = TokenClass.DoctypeStart;
         d.EndToken.Class = TokenClass.TagEnd;
     }
     return res;
 }
 public virtual void WriteDoctypeDeclaration(Doctype type)
 {
 }
Exemplo n.º 10
0
 public virtual void ImportDoctype(Doctype doc)
 {
     ImportToken(doc.StartToken);
     ImportChildren(doc.Children);
     ImportToken(doc.EndToken);
     ImportNewLineAfter(doc.NewLineAfter);
 }
Exemplo n.º 11
0
 public override int GetHashCode() => Doctype.GetHashCode();