Exemple #1
0
 public void Write(HtmlNode node)
 {
     if (node is HtmlText)
     {
         Write((HtmlText)node);
     }
     else if (node is HtmlElement)
     {
         if (node is HtmlDocument)
         {
             WriteChildren(node);
         }
         else
         {
             Write((HtmlElement)node);
         }
     }
     else if (node is HtmlRaw)
     {
         Write((HtmlRaw)node);
     }
     else if (node is HtmlCDATA)
     {
         Write((HtmlCDATA)node);
     }
     else if (node is HtmlComment)
     {
         Write((HtmlComment)node);
     }
     else if (node is HtmlDOCTYPE)
     {
         Write((HtmlDOCTYPE)node);
     }
     else if (node is HtmlAspDelimiter)
     {
         Write((HtmlAspDelimiter)node);
     }
     else
     {
         throw new NotSupportedException($"Unsupported node type [{node?.GetType()}]");
     }
 }
Exemple #2
0
 public void Write(HtmlNode node)
 {
     if (node is HtmlText)
     {
         Write((HtmlText)node);
     }
     else if (node is HtmlElement)
     {
         if (node is HtmlDocument)
         {
             WriteChildren(node);
         }
         else
         {
             Write((HtmlElement)node);
         }
     }
     else if (node is HtmlRaw)
     {
         Write((HtmlRaw)node);
     }
     else if (node is HtmlCDATA)
     {
         Write((HtmlCDATA)node);
     }
     else if (node is HtmlComment)
     {
         Write((HtmlComment)node);
     }
     else if (node is HtmlDOCTYPE)
     {
         Write((HtmlDOCTYPE)node);
     }
     else
     {
         throw new InvalidOperationException($"Unsupported tag node [{node?.GetType()}]");
     }
 }