本文整理了Java中net.htmlparser.jericho.Element.getName()
方法的一些代码示例,展示了Element.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getName()
方法的具体详情如下:
包路径:net.htmlparser.jericho.Element
类名称:Element
方法名:getName
[英]Returns the StartTag#getName() of the #getStartTag() of this element, always in lower case.
This is equivalent to #getStartTag().
StartTag#getName().
See the Tag#getName() method for more information.
[中]返回此元素的#getStartTag()的StartTag#getName(),始终以小写形式。
这相当于#getStartTag().
StartTag#getName()。
有关更多信息,请参阅标记#getName()方法。
代码示例来源: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
@Override
public void element(final Element element, final Context context, final BugList bugs) {
final String tagName = element.getName();
if (tagName.equals(CF.CFQUERY)) {
String queryGuts = element.getContent().toString().replaceAll("\\s+", "");
queryGuts = queryGuts.toLowerCase();
if (queryGuts.contains(selectStar)) {
context.addMessage("SQL_SELECT_STAR", null);
}
}
}
}
代码示例来源:origin: org.teavm.flavour/teavm-flavour-templates
private TemplateNode parseElement(Element elem) {
if (elem.getName().indexOf(':') > 0) {
return parseComponent(elem);
} else {
return parseDomElement(elem);
}
}
代码示例来源: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: net.htmlparser.jericho/jericho-html
private boolean containsOnlyInlineLevelChildElements(final Element element) {
// returns true if the element contains only inline-level elements except for SCRIPT elements.
final Collection<Element> childElements=element.getChildElements();
if (childElements.isEmpty()) return true;
for (Element childElement : childElements) {
final String elementName=childElement.getName();
if (elementName==HTMLElementName.SCRIPT || !HTMLElements.getInlineLevelElementNames().contains(elementName)) return false;
if (!containsOnlyInlineLevelChildElements(childElement)) return false;
}
return true;
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if ("script".equals(element.getName())) {
final String src = element.getStartTag().toString();
if (!src.matches(".*src=.*")) {
context.addMessage("AVOID_USING_INLINE_JS", null);
}
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if ("script".equals(element.getName())) {
final String src = element.getStartTag().toString();
if (!src.matches(".*src=.*")) {
context.addMessage("AVOID_USING_INLINE_JS", null);
}
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
final String elementName = element.getName();
if (elementName.equals(CF.CFCOMPONENT)) {
// this includes whitespace-change it
final int total = element.getContent().toString().split("\\n").length;
checkSize(LENGTH_THRESHOLD, "EXCESSIVE_COMPONENT_LENGTH", context, 1, 0, total, bugs);
}
}
}
代码示例来源:origin: cflint/CFLint
/**
* Parse a CF argument tag to see if the argument hint is missing.
*/
@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 hint = element.getAttributeValue(CF.HINT);
if (hint == null || hint.length() == 0) {
context.addMessage("ARG_HINT_MISSING", name);
}
}
}
代码示例来源:origin: net.htmlparser.jericho/jericho-html
private static ElementHandler getElementHandler(final Element element) {
if (element.getStartTag().getStartTagType().isServerTag()) return RemoveElementHandler.INSTANCE; // hard-coded configuration does not include server tags in child element hierarchy, so this is normally not executed.
ElementHandler elementHandler=ELEMENT_HANDLERS.get(element.getName());
return (elementHandler!=null) ? elementHandler : StandardInlineElementHandler.INSTANCE;
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFFUNCTION) && !trivalFunction(context.getFunctionName())) {
functionCount++;
checkNumberFunctions(functionCount, 1, 0, context, bugs, null);
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFFUNCTION) && !trivalFunction(context.getFunctionName())) {
functionCount++;
checkNumberFunctions(functionCount, 1, 0, context, bugs, null);
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
final String tagName = element.getName();
final String cfmlTagCheck = context.getConfiguration().getParameter(this,"tagName");
final String scope = context.getConfiguration().getParameter(this,"scope");
if (cfmlTagCheck != null && tagName.matches(cfmlTagCheck)) {
if (scope == null || scope.equals(CF.COMPONENT) && context.isInComponent()) {
context.addMessage("AVOID_USING_" + tagName.toUpperCase() + "_TAG", tagName);
}
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
final String tagName = element.getName();
final String cfmlTagCheck = context.getConfiguration().getParameter(this,"tagName");
final String scope = context.getConfiguration().getParameter(this,"scope");
if (cfmlTagCheck != null && tagName.matches(cfmlTagCheck)) {
if (scope == null || scope.equals(CF.COMPONENT) && context.isInComponent()) {
context.addMessage("AVOID_USING_" + tagName.toUpperCase() + "_TAG", tagName);
}
}
}
}
代码示例来源:origin: cflint/CFLint
/**
* Parse CF component tag declaration to see if the component name is invalid.
*/
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFCOMPONENT)) {
final String name = context.getFilename().replace(".cfc", "");
checkNameForBugs(context, actualFileName(name), context.getFilename(), context.startLine(), element.getBegin(), 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.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.CFARGUMENT)) {
final String name = element.getAttributeValue(CF.NAME);
final boolean required = CFTool.toBoolean(element.getAttributeValue(CF.REQUIRED));
final String defaultExpr = element.getAttributeValue(CF.DEFAULT);
if (!required && defaultExpr == null) {
element.getSource().getRow(element.getBegin());
element.getSource().getColumn(element.getBegin());
context.addMessage("ARG_DEFAULT_MISSING", name);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!