本文整理汇总了C#中TidyNet.Node类的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于TidyNet命名空间,在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Check
public virtual void Check(Lexer lexer, Node node)
{
AttVal attval;
Attribute attribute;
bool hasAlt = false;
bool hasHref = false;
node.CheckUniqueAttributes(lexer);
for (attval = node.Attributes; attval != null; attval = attval.Next)
{
attribute = attval.CheckAttribute(lexer, node);
if (attribute == AttributeTable.AttrAlt)
{
hasAlt = true;
}
else if (attribute == AttributeTable.AttrHref)
{
hasHref = true;
}
}
if (!hasAlt)
{
lexer.badAccess |= Report.MISSING_LINK_ALT;
Report.AttrError(lexer, node, "alt", Report.MISSING_ATTRIBUTE);
}
if (!hasHref)
{
Report.AttrError(lexer, node, "href", Report.MISSING_ATTRIBUTE);
}
}
示例2: Check
public virtual void Check(Lexer lexer, Node node)
{
node.CheckUniqueAttributes(lexer);
AttVal lang = node.GetAttrByName("language");
AttVal type = node.GetAttrByName("type");
if (type == null)
{
Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);
/* check for javascript */
if (lang != null)
{
string str = lang.Val;
if (str.Length > 10)
{
str = str.Substring(0, 10);
}
if ((String.Compare(str, "javascript") == 0) || (String.Compare(str, "jscript") == 0))
{
node.AddAttribute("type", "text/javascript");
}
}
else
{
node.AddAttribute("type", "text/javascript");
}
}
}
示例3: Check
public virtual void Check(Lexer lexer, Node node)
{
AttVal attval;
string val = null;
node.CheckUniqueAttributes(lexer);
for (attval = node.Attributes; attval != null; attval = attval.Next)
{
if (String.Compare(attval.Attribute, "align") == 0)
{
val = attval.Val;
break;
}
}
if (val != null)
{
if (String.Compare(val, "left") == 0 || String.Compare(val, "right") == 0)
{
lexer.versions &= HtmlVersion.Html40Loose | HtmlVersion.Frames;
}
else if (String.Compare(val, "top") == 0 || String.Compare(val, "bottom") == 0)
{
lexer.versions &= HtmlVersion.From32;
}
else
{
Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
}
}
}
示例4: PreTraverse
protected internal virtual void PreTraverse(Node node)
{
if (node == null)
{
return;
}
if (node.Type == Node.StartTag || node.Type == Node.StartEndTag)
{
if (_currIndex <= _maxIndex && (_tagName.Equals("*") || _tagName.Equals(node.Element)))
{
_currIndex += 1;
_currNode = node;
}
}
if (_currIndex > _maxIndex)
{
return;
}
node = node.Content;
while (node != null)
{
PreTraverse(node);
node = node.Next;
}
}
示例5: Check
public virtual void Check(Lexer lexer, Node node)
{
if (node.GetAttrByName("src") != null)
{
Report.AttrError(lexer, node, "src", Report.PROPRIETARY_ATTR_VALUE);
}
}
示例6: Check
public virtual void Check(Lexer lexer, Node node, AttVal attval)
{
string val = attval.Val;
if (val == null)
{
Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
}
else if (String.Compare(val, "top") == 0 || String.Compare(val, "middle") == 0 || String.Compare(val, "bottom") == 0 || String.Compare(val, "baseline") == 0)
{
/* all is fine */
}
else if (String.Compare(val, "left") == 0 || String.Compare(val, "right") == 0)
{
if (!(node.Tag != null && ((node.Tag.Model & ContentModel.Img) != 0)))
{
Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
}
}
else if (String.Compare(val, "texttop") == 0 || String.Compare(val, "absmiddle") == 0 || String.Compare(val, "absbottom") == 0 || String.Compare(val, "textbottom") == 0)
{
lexer.versions &= HtmlVersion.Proprietary;
Report.AttrError(lexer, node, val, Report.PROPRIETARY_ATTR_VALUE);
}
else
{
Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
}
}
示例7: Check
public virtual void Check(Lexer lexer, Node node, AttVal attval)
{
if (attval.Val == null)
{
Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
}
else if (lexer.Options.FixBackslash)
{
attval.Val = attval.Val.Replace('\\', '/');
}
}
示例8: Check
public virtual void Check(Lexer lexer, Node node)
{
AttVal type = node.GetAttrByName("type");
node.CheckUniqueAttributes(lexer);
if (type == null)
{
Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);
node.AddAttribute("type", "text/css");
}
}
示例9: Check
public virtual void Check(Lexer lexer, Node node)
{
node.CheckUniqueAttributes(lexer);
/*
HTML4 strict doesn't allow mixed content for
elements with %block; as their content model
*/
if (node.GetAttrByName("width") != null || node.GetAttrByName("height") != null)
{
lexer.versions &= ~ HtmlVersion.Html40Strict;
}
}
示例10: Check
public virtual void Check(Lexer lexer, Node node)
{
AttVal attval;
node.CheckUniqueAttributes(lexer);
for (attval = node.Attributes; attval != null; attval = attval.Next)
{
Attribute attribute = attval.CheckAttribute(lexer, node);
if (attribute == AttributeTable.AttrXmlns)
{
lexer.isvoyager = true;
}
}
}
示例11: Check
public virtual void Check(Lexer lexer, Node node)
{
AttVal rel = node.GetAttrByName("rel");
node.CheckUniqueAttributes(lexer);
if (rel != null && rel.Val != null && rel.Val.Equals("stylesheet"))
{
AttVal type = node.GetAttrByName("type");
if (type == null)
{
Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);
node.AddAttribute("type", "text/css");
}
}
}
示例12: Check
public virtual void Check(Lexer lexer, Node node, AttVal attval)
{
string val;
/* IMG, OBJECT, APPLET and EMBED use align for vertical position */
if (node.Tag != null && ((node.Tag.Model & ContentModel.Img) != 0))
{
TidyNet.AttrCheckImpl.CheckValign.Check(lexer, node, attval);
return;
}
val = attval.Val;
if (val == null)
{
Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
}
else if (!(String.Compare(val, "left") == 0 || String.Compare(val, "center") == 0 || String.Compare(val, "right") == 0 || String.Compare(val, "justify") == 0))
{
Report.AttrError(lexer, node, attval.Val, Report.BAD_ATTRIBUTE_VALUE);
}
}
示例13: Check
public virtual void Check(Lexer lexer, Node node)
{
AttVal attval;
Attribute attribute;
bool hasSummary = false;
node.CheckUniqueAttributes(lexer);
for (attval = node.Attributes; attval != null; attval = attval.Next)
{
attribute = attval.CheckAttribute(lexer, node);
if (attribute == AttributeTable.AttrSummary)
{
hasSummary = true;
}
}
/* suppress warning for missing summary for HTML 2.0 and HTML 3.2 */
if (!hasSummary && lexer.doctype != HtmlVersion.Html20 && lexer.doctype != HtmlVersion.Html32)
{
lexer.badAccess |= Report.MISSING_SUMMARY;
Report.AttrError(lexer, node, "summary", Report.MISSING_ATTRIBUTE);
}
/* convert <table border> to <table border="1"> */
if (lexer.Options.XmlOut)
{
attval = node.GetAttrByName("border");
if (attval != null)
{
if (attval.Val == null)
{
attval.Val = "1";
}
}
}
}
示例14: FindParser
public IParser FindParser(Node node)
{
Dict np;
if (node.Element != null)
{
np = Lookup(node.Element);
if (np != null)
{
return np.Parser;
}
}
return null;
}
示例15: DomNodeImpl
protected internal DomNodeImpl(Node adaptee)
{
_adaptee = adaptee;
}