本文整理汇总了C#中TidyNet.Node.CheckUniqueAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# Node.CheckUniqueAttributes方法的具体用法?C# Node.CheckUniqueAttributes怎么用?C# Node.CheckUniqueAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TidyNet.Node
的用法示例。
在下文中一共展示了Node.CheckUniqueAttributes方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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");
}
}
}
示例2: 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);
}
}
}
示例3: 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);
}
}
示例4: 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");
}
}
示例5: 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;
}
}
示例6: 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;
}
}
}
示例7: 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");
}
}
}
示例8: 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";
}
}
}
}
示例9: GetToken
//.........这里部分代码省略.........
}
else if (c != '\n' && c != '\f')
{
input.UngetChar(c);
}
waswhite = true; /* to swallow leading whitespace */
}
else
{
waswhite = false;
}
state = LEX_CONTENT;
if (token.Tag == null)
{
Report.Error(this, null, token, Report.UNKNOWN_ELEMENT);
}
else if (!Options.XmlTags)
{
versions &= token.Tag.Versions;
if ((token.Tag.Versions & HtmlVersion.Proprietary) != 0)
{
if (!Options.MakeClean && (token.Tag == Options.tt.TagNobr || token.Tag == Options.tt.TagWbr))
{
Report.Warning(this, null, token, Report.PROPRIETARY_ELEMENT);
}
}
if (token.Tag.CheckAttribs != null)
{
token.CheckUniqueAttributes(this);
token.Tag.CheckAttribs.Check(this, this.token);
}
else
{
token.CheckAttributes(this);
}
}
return token; /* return start tag */
case LEX_COMMENT:
if (c != '-')
{
continue;
}
c = input.ReadChar();
AddCharToLexer(c);
if (c != '-')
{
continue;
}
while (true)
{
c = input.ReadChar();
if (c == '>')
{
if (badcomment != 0)
{
Report.Warning(this, null, null, Report.MALFORMED_COMMENT);
}
示例10: Check
public virtual void Check(Lexer lexer, Node node)
{
node.CheckUniqueAttributes(lexer);
lexer.FixId(node);
}
示例11: Check
public virtual void Check(Lexer lexer, Node node)
{
AttVal attval;
Attribute attribute;
bool hasAlt = false;
bool hasSrc = false;
bool hasUseMap = false;
bool hasIsMap = false;
bool hasDataFld = 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.AttrSrc)
{
hasSrc = true;
}
else if (attribute == AttributeTable.AttrUsemap)
{
hasUseMap = true;
}
else if (attribute == AttributeTable.AttrIsmap)
{
hasIsMap = true;
}
else if (attribute == AttributeTable.AttrDatafld)
{
hasDataFld = true;
}
else if (attribute == AttributeTable.AttrWidth || attribute == AttributeTable.AttrHeight)
{
lexer.versions &= ~ HtmlVersion.Html20;
}
}
if (!hasAlt)
{
lexer.badAccess |= Report.MISSING_IMAGE_ALT;
Report.AttrError(lexer, node, "alt", Report.MISSING_ATTRIBUTE);
if (lexer.Options.AltText != null)
{
node.AddAttribute("alt", lexer.Options.AltText);
}
}
if (!hasSrc && !hasDataFld)
{
Report.AttrError(lexer, node, "src", Report.MISSING_ATTRIBUTE);
}
if (hasIsMap && !hasUseMap)
{
Report.AttrError(lexer, node, "ismap", Report.MISSING_IMAGEMAP);
}
}