本文整理了Java中net.htmlparser.jericho.Element.getAttributeValue()
方法的一些代码示例,展示了Element.getAttributeValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getAttributeValue()
方法的具体详情如下:
包路径:net.htmlparser.jericho.Element
类名称:Element
方法名:getAttributeValue
[英]Returns the CharacterReference#decode(CharSequence) value of the attribute with the specified name (case insensitive).
Returns null
if the #getStartTag() does not StartTagType#hasAttributes(), no attribute with the specified name exists or the attribute Attribute#hasValue().
This is equivalent to #getStartTag().
StartTag#getAttributeValue(String).
[中]返回具有指定名称(不区分大小写)的属性的CharacterReference#decode(CharSequence)值。
返回null
如果#getStartTag()未启动tTagType#hasAttributes(),则不存在具有指定名称的属性或属性#hasValue()。
这相当于#getStartTag().
StartTag#getAttributeValue(字符串)。
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (// element.getName().equals(CF.CFCOMPONENT) ||
element.getName().equals(CF.CFFUNCTION)) {
final String outputAttr = element.getAttributeValue(CF.OUTPUT);
if (outputAttr == null) {
context.addMessage("OUTPUT_ATTR", element.getAttributeValue(CF.NAME));
}
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (// element.getName().equals(CF.CFCOMPONENT) ||
element.getName().equals(CF.CFFUNCTION)) {
final String outputAttr = element.getAttributeValue(CF.OUTPUT);
if (outputAttr == null) {
context.addMessage("OUTPUT_ATTR", element.getAttributeValue(CF.NAME));
}
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFARGUMENT)) {
final String name = element.getAttributeValue(CF.NAME);
final String variableType = element.getAttributeValue(CF.TYPE);
if (variableType == null) {
context.addMessage("ARG_TYPE_MISSING", name);
} else if ("any".equals(variableType)) {
context.addMessage("ARG_TYPE_ANY", name);
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFARGUMENT)) {
final String name = element.getAttributeValue(CF.NAME);
final String variableType = element.getAttributeValue(CF.TYPE);
if (variableType == null) {
context.addMessage("ARG_TYPE_MISSING", name);
} else if ("any".equals(variableType)) {
context.addMessage("ARG_TYPE_ANY", name);
}
}
}
代码示例来源:origin: cflint/CFLint
@SuppressWarnings("unchecked")
private void checkAttributes(final Element element, final CFLintConfiguration configuration) {
for (String tagInfo : (List<String>)configuration.getParameter(this,"usedTagAttributes", List.class)) {
final String[] parts = (tagInfo + "//").split("/");
if (element.getName() != null && parts[0].equalsIgnoreCase(element.getName())) {
final String name = element.getAttributeValue(parts[1]);
if (name != null && localVariables.containsKey(name.toLowerCase())) {
localVariables.put(name.toLowerCase(), new VarInfo(name, true));
}
}
}
}
代码示例来源:origin: cflint/CFLint
@SuppressWarnings("unchecked")
private void checkAttributes(final Element element, final CFLintConfiguration configuration) {
for (String tagInfo : (List<String>)configuration.getParameter(this,"usedTagAttributes", List.class)) {
final String[] parts = (tagInfo + "//").split("/");
if (element.getName() != null && parts[0].equalsIgnoreCase(element.getName())) {
final String name = element.getAttributeValue(parts[1]);
if (name != null && localVariables.containsKey(name.toLowerCase())) {
localVariables.put(name.toLowerCase(), new VarInfo(name, true));
}
}
}
}
代码示例来源:origin: cflint/CFLint
/**
* Parse a CF function tag declaration to see if it's missing a hint.
*/
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFFUNCTION)) {
final String hint = element.getAttributeValue("hint");
if (hint == null || hint.trim().isEmpty()) {
context.addMessage(FUNCTION_HINT_MISSING, context.getFunctionName());
}
}
}
代码示例来源:origin: cflint/CFLint
/**
* Parse a CF component tag declaration to see if it's missing a hint.
*/
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFCOMPONENT)) {
final String hint = element.getAttributeValue(CF.HINT);
if (hint == null || hint.trim().isEmpty()) {
context.addMessage(COMPONENT_HINT_MISSING, context.calcComponentName());
}
}
}
代码示例来源:origin: cflint/CFLint
/**
* Parse a CF component tag declaration to see if it's missing a hint.
*/
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFCOMPONENT)) {
final String hint = element.getAttributeValue(CF.HINT);
if (hint == null || hint.trim().isEmpty()) {
context.addMessage(COMPONENT_HINT_MISSING, context.calcComponentName());
}
}
}
代码示例来源:origin: cflint/CFLint
/**
* Parse a CF function tag declaration to see if it's missing a hint.
*/
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFFUNCTION)) {
final String hint = element.getAttributeValue("hint");
if (hint == null || hint.trim().isEmpty()) {
context.addMessage(FUNCTION_HINT_MISSING, context.getFunctionName());
}
}
}
代码示例来源:origin: cflint/CFLint
private final boolean anyContainingCFOutputHasQuery(final Element element) {
if (element == null) {
return false;
}
if (element.getAttributeValue(CF.QUERY) != null) {
return true;
}
return anyContainingCFOutputHasQuery(CFTool.getNamedParent(element, CF.CFOUTPUT));
}
代码示例来源:origin: cflint/CFLint
private final boolean anyContainingCFOutputHasQuery(final Element element) {
if (element == null) {
return false;
}
if (element.getAttributeValue(CF.QUERY) != null) {
return true;
}
return anyContainingCFOutputHasQuery(CFTool.getNamedParent(element, CF.CFOUTPUT));
}
代码示例来源:origin: net.htmlparser.jericho/jericho-html
private static String getOptionLabel(final Element optionElement) {
final String labelAttributeValue=optionElement.getAttributeValue("label");
if (labelAttributeValue!=null) return labelAttributeValue;
return CharacterReference.decodeCollapseWhiteSpace(optionElement.getContent());
}
private final class OptionElementIterator implements Iterator<Element> {
代码示例来源:origin: mozilla/zest
private String getReturnValue(Element element) throws ZestAssignFailException {
if (returnElement) {
return element.getContent().toString();
} else if (returnAttribute) {
return element.getAttributeValue(returnedAttributeName);
} else {
throw new ZestAssignFailException(this, "A selection method must be configured");
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFFUNCTION)) {
final int begLine = element.getSource().getRow(element.getBegin());
final String functionType = element.getAttributeValue("returnType");
checkReturnType(functionType, begLine, context, bugs);
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFFUNCTION)) {
final int begLine = element.getSource().getRow(element.getBegin());
final String functionType = element.getAttributeValue("returnType");
checkReturnType(functionType, begLine, context, bugs);
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFCOMPONENT)) {
final String name = context.getComponentName();
final String nameAttribute = element.getAttributeValue(CF.NAME);
if (nameAttribute != null) {
didYouMeanDisplayName(name, element.getSource().getRow(element.getBegin()), context.offset() + element.getBegin(), context, bugs);
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFCOMPONENT)) {
final String name = context.getComponentName();
final String nameAttribute = element.getAttributeValue(CF.NAME);
if (nameAttribute != null) {
didYouMeanDisplayName(name, element.getSource().getRow(element.getBegin()), context.offset() + element.getBegin(), context, bugs);
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFOUTPUT)) {
final Element parent = CFTool.getNamedParent(element, CF.CFOUTPUT);
if (parent != null) {
if (parent.getAttributeValue(CF.GROUP) == null && anyContainingCFOutputHasQuery(parent)) {
element.getSource().getRow(element.getBegin());
element.getSource().getColumn(element.getBegin());
context.addMessage("NESTED_CFOUTPUT", "");
}
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFOUTPUT)) {
final Element parent = CFTool.getNamedParent(element, CF.CFOUTPUT);
if (parent != null) {
if (parent.getAttributeValue(CF.GROUP) == null && anyContainingCFOutputHasQuery(parent)) {
element.getSource().getRow(element.getBegin());
element.getSource().getColumn(element.getBegin());
context.addMessage("NESTED_CFOUTPUT", "");
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!