本文整理了Java中net.htmlparser.jericho.Element.getBegin()
方法的一些代码示例,展示了Element.getBegin()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getBegin()
方法的具体详情如下:
包路径:net.htmlparser.jericho.Element
类名称:Element
方法名:getBegin
暂无
代码示例来源:origin: cflint/CFLint
/**
* 'Detect' if this is a pure cfscript component or interface
*
* @param src
* @param elements
* @return
*/
private boolean isComponentOrInterfaceScript(final String src, final List<Element> elements) {
return (src.contains(CF.COMPONENT)
&& (elements.isEmpty() || elements.get(0).getBegin() > src.indexOf(CF.COMPONENT)))
|| (src.contains(CF.INTERFACE)
&& (elements.isEmpty() || elements.get(0).getBegin() > src.indexOf(CF.INTERFACE)));
}
代码示例来源:origin: net.htmlparser.jericho/jericho-html
public int compare(final FormControl formControl1, final FormControl formControl2) {
final int formControl1Begin=formControl1.getElement().getBegin();
final int formControl2Begin=formControl2.getElement().getBegin();
if (formControl1Begin<formControl2Begin) return -1;
if (formControl1Begin>formControl2Begin) return 1;
return 0;
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
final String file = context.getFilename();
final String ext = file.substring(file.length() - 3, file.length());
final String tagName = element.getName();
if (tagName.equals(CF.CFQUERY) && "cfm".equals(ext)) {
final int begLine = element.getSource().getRow(element.getBegin());
context.addMessage(NEVER_USE_QUERY_IN_CFM, null, this, begLine, element.getBegin());
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
final String file = context.getFilename();
final String ext = file.substring(file.length() - 3, file.length());
final String tagName = element.getName();
if (tagName.equals(CF.CFQUERY) && "cfm".equals(ext)) {
final int begLine = element.getSource().getRow(element.getBegin());
context.addMessage(NEVER_USE_QUERY_IN_CFM, null, this, begLine, element.getBegin());
}
}
}
代码示例来源:origin: cflint/CFLint
/**
* Parse CF function tag declaration to see if the function name is invalid.
*/
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFFUNCTION)) {
final int lineNo = element.getSource().getRow(element.getBegin());
checkNameForBugs(context, lineNo, element.getBegin());
}
}
代码示例来源:origin: cflint/CFLint
/**
* Parse CF function tag declaration to see if the function name is invalid.
*/
@Override
public void element(final Element element, final Context context, final BugList bugs) {
if (element.getName().equals(CF.CFFUNCTION)) {
final int lineNo = element.getSource().getRow(element.getBegin());
checkNameForBugs(context, lineNo, element.getBegin());
}
}
代码示例来源: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.CFFUNCTION)) {
// this includes whitespace-change it
final int begLine = element.getSource().getRow(element.getBegin());
final int offset = element.getBegin();
final int total = element.getAllStartTags().size();
checkSize(LENGTH_THRESHOLD, "EXCESSIVE_FUNCTION_LENGTH", context, begLine, offset, total, bugs);
}
}
代码示例来源: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.CFFUNCTION)) {
// this includes whitespace-change it
final int begLine = element.getSource().getRow(element.getBegin());
final int offset = element.getBegin();
final int total = element.getAllStartTags().size();
checkSize(LENGTH_THRESHOLD, "EXCESSIVE_FUNCTION_LENGTH", context, begLine, offset, total, 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
public int startLine() {
if (element != null && element.getSource() != null) {
return element.getSource().getRow(element.getBegin());
} else {
return 1; // not zero
}
}
代码示例来源:origin: cflint/CFLint
public int startLine() {
if (element != null && element.getSource() != null) {
return element.getSource().getRow(element.getBegin());
} else {
return 1; // not zero
}
}
代码示例来源: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
/**
* 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.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
public int offset() {
if (element != null) {
if (element.getName().equalsIgnoreCase(CF.CFSCRIPT)) {
return element.getStartTag().getEnd();
} else if (element.getName().equalsIgnoreCase(CF.CFSET)) {
return element.getStartTag().getTagContent().getBegin() + 1;
}
return element.getBegin();
} else {
return 0;
}
}
代码示例来源:origin: cflint/CFLint
public int offset() {
if (element != null) {
if (element.getName().equalsIgnoreCase(CF.CFSCRIPT)) {
return element.getStartTag().getEnd();
} else if (element.getName().equalsIgnoreCase(CF.CFSET)) {
return element.getStartTag().getTagContent().getBegin() + 1;
}
return element.getBegin();
} else {
return 0;
}
}
代码示例来源: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);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!