本文整理了Java中net.htmlparser.jericho.Element.getSource()
方法的一些代码示例,展示了Element.getSource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getSource()
方法的具体详情如下:
包路径:net.htmlparser.jericho.Element
类名称:Element
方法名:getSource
暂无
代码示例来源: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
@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
@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.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
/**
* 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) {
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) {
final String elementName = element.getName();
final int begLine = element.getSource().getRow(element.getBegin());
final int offset = element.getBegin();
if (elementName.equals(CF.CFQUERY)) {
checkCFName(element, context, bugs, begLine, offset, CF.NAME);
} else if (elementName.equals(CF.CFINVOKE)) {
checkCFName(element, context, bugs, begLine, offset, CF.RETURNVARIABLE);
} else if (elementName.equals(CF.CFLOOP)) {
checkCFLoopName(element, context, bugs, begLine, element.getBegin());
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
final String elementName = element.getName();
final int begLine = element.getSource().getRow(element.getBegin());
final int offset = element.getBegin();
if (elementName.equals(CF.CFQUERY)) {
checkCFName(element, context, bugs, begLine, offset, CF.NAME);
} else if (elementName.equals(CF.CFINVOKE)) {
checkCFName(element, context, bugs, begLine, offset, CF.RETURNVARIABLE);
} else if (elementName.equals(CF.CFLOOP)) {
checkCFLoopName(element, context, bugs, begLine, element.getBegin());
}
}
代码示例来源: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.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);
}
}
}
代码示例来源: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);
}
}
}
代码示例来源:origin: wala/WALA
public Pair<Integer, String> getBodyText() {
Segment content = innerElement.getContent();
Integer lineNum = innerElement.getSource().getRow(content.getBegin());
String nl = content.getSource().getNewLine();
String body = nl==null? content.toString(): content.toString().replace(nl, "\n");
return Pair.make(lineNum, body);
}
代码示例来源: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: com.ibm.wala/com.ibm.wala.cast.js
public Pair<Integer, String> getBodyText() {
Segment content = innerElement.getContent();
Integer lineNum = innerElement.getSource().getRow(content.getBegin());
String nl = content.getSource().getNewLine();
String body = nl==null? content.toString(): content.toString().replace(nl, "\n");
return Pair.make(lineNum, body);
}
内容来源于网络,如有侵权,请联系作者删除!