net.htmlparser.jericho.Element.getSource()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(244)

本文整理了Java中net.htmlparser.jericho.Element.getSource()方法的一些代码示例,展示了Element.getSource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getSource()方法的具体详情如下:
包路径:net.htmlparser.jericho.Element
类名称:Element
方法名:getSource

Element.getSource介绍

暂无

代码示例

代码示例来源:origin: cflint/CFLint

  1. public int startLine() {
  2. if (element != null && element.getSource() != null) {
  3. return element.getSource().getRow(element.getBegin());
  4. } else {
  5. return 1; // not zero
  6. }
  7. }

代码示例来源:origin: cflint/CFLint

  1. public int startLine() {
  2. if (element != null && element.getSource() != null) {
  3. return element.getSource().getRow(element.getBegin());
  4. } else {
  5. return 1; // not zero
  6. }
  7. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. final String file = context.getFilename();
  4. final String ext = file.substring(file.length() - 3, file.length());
  5. final String tagName = element.getName();
  6. if (tagName.equals(CF.CFQUERY) && "cfm".equals(ext)) {
  7. final int begLine = element.getSource().getRow(element.getBegin());
  8. context.addMessage(NEVER_USE_QUERY_IN_CFM, null, this, begLine, element.getBegin());
  9. }
  10. }
  11. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. final String file = context.getFilename();
  4. final String ext = file.substring(file.length() - 3, file.length());
  5. final String tagName = element.getName();
  6. if (tagName.equals(CF.CFQUERY) && "cfm".equals(ext)) {
  7. final int begLine = element.getSource().getRow(element.getBegin());
  8. context.addMessage(NEVER_USE_QUERY_IN_CFM, null, this, begLine, element.getBegin());
  9. }
  10. }
  11. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. final String elementName = element.getName();
  4. if (elementName.equals(CF.CFFUNCTION)) {
  5. // this includes whitespace-change it
  6. final int begLine = element.getSource().getRow(element.getBegin());
  7. final int offset = element.getBegin();
  8. final int total = element.getAllStartTags().size();
  9. checkSize(LENGTH_THRESHOLD, "EXCESSIVE_FUNCTION_LENGTH", context, begLine, offset, total, bugs);
  10. }
  11. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. final String elementName = element.getName();
  4. if (elementName.equals(CF.CFFUNCTION)) {
  5. // this includes whitespace-change it
  6. final int begLine = element.getSource().getRow(element.getBegin());
  7. final int offset = element.getBegin();
  8. final int total = element.getAllStartTags().size();
  9. checkSize(LENGTH_THRESHOLD, "EXCESSIVE_FUNCTION_LENGTH", context, begLine, offset, total, bugs);
  10. }
  11. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. if (element.getName().equals(CF.CFFUNCTION)) {
  4. final int begLine = element.getSource().getRow(element.getBegin());
  5. final String functionType = element.getAttributeValue("returnType");
  6. checkReturnType(functionType, begLine, context, bugs);
  7. }
  8. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. if (element.getName().equals(CF.CFFUNCTION)) {
  4. final int begLine = element.getSource().getRow(element.getBegin());
  5. final String functionType = element.getAttributeValue("returnType");
  6. checkReturnType(functionType, begLine, context, bugs);
  7. }
  8. }

代码示例来源:origin: cflint/CFLint

  1. /**
  2. * Parse CF function tag declaration to see if the function name is invalid.
  3. */
  4. @Override
  5. public void element(final Element element, final Context context, final BugList bugs) {
  6. if (element.getName().equals(CF.CFFUNCTION)) {
  7. final int lineNo = element.getSource().getRow(element.getBegin());
  8. checkNameForBugs(context, lineNo, element.getBegin());
  9. }
  10. }

代码示例来源:origin: cflint/CFLint

  1. /**
  2. * Parse CF function tag declaration to see if the function name is invalid.
  3. */
  4. @Override
  5. public void element(final Element element, final Context context, final BugList bugs) {
  6. if (element.getName().equals(CF.CFFUNCTION)) {
  7. final int lineNo = element.getSource().getRow(element.getBegin());
  8. checkNameForBugs(context, lineNo, element.getBegin());
  9. }
  10. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. if (element.getName().equals(CF.CFOUTPUT)) {
  4. final Element parent = CFTool.getNamedParent(element, CF.CFOUTPUT);
  5. if (parent != null) {
  6. if (parent.getAttributeValue(CF.GROUP) == null && anyContainingCFOutputHasQuery(parent)) {
  7. element.getSource().getRow(element.getBegin());
  8. element.getSource().getColumn(element.getBegin());
  9. context.addMessage("NESTED_CFOUTPUT", "");
  10. }
  11. }
  12. }
  13. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. final String elementName = element.getName();
  4. final int begLine = element.getSource().getRow(element.getBegin());
  5. final int offset = element.getBegin();
  6. if (elementName.equals(CF.CFQUERY)) {
  7. checkCFName(element, context, bugs, begLine, offset, CF.NAME);
  8. } else if (elementName.equals(CF.CFINVOKE)) {
  9. checkCFName(element, context, bugs, begLine, offset, CF.RETURNVARIABLE);
  10. } else if (elementName.equals(CF.CFLOOP)) {
  11. checkCFLoopName(element, context, bugs, begLine, element.getBegin());
  12. }
  13. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. final String elementName = element.getName();
  4. final int begLine = element.getSource().getRow(element.getBegin());
  5. final int offset = element.getBegin();
  6. if (elementName.equals(CF.CFQUERY)) {
  7. checkCFName(element, context, bugs, begLine, offset, CF.NAME);
  8. } else if (elementName.equals(CF.CFINVOKE)) {
  9. checkCFName(element, context, bugs, begLine, offset, CF.RETURNVARIABLE);
  10. } else if (elementName.equals(CF.CFLOOP)) {
  11. checkCFLoopName(element, context, bugs, begLine, element.getBegin());
  12. }
  13. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. if (element.getName().equals(CF.CFOUTPUT)) {
  4. final Element parent = CFTool.getNamedParent(element, CF.CFOUTPUT);
  5. if (parent != null) {
  6. if (parent.getAttributeValue(CF.GROUP) == null && anyContainingCFOutputHasQuery(parent)) {
  7. element.getSource().getRow(element.getBegin());
  8. element.getSource().getColumn(element.getBegin());
  9. context.addMessage("NESTED_CFOUTPUT", "");
  10. }
  11. }
  12. }
  13. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. if (element.getName().equals(CF.CFARGUMENT)) {
  4. final String name = element.getAttributeValue(CF.NAME);
  5. final boolean required = CFTool.toBoolean(element.getAttributeValue(CF.REQUIRED));
  6. final String defaultExpr = element.getAttributeValue(CF.DEFAULT);
  7. if (!required && defaultExpr == null) {
  8. element.getSource().getRow(element.getBegin());
  9. element.getSource().getColumn(element.getBegin());
  10. context.addMessage("ARG_DEFAULT_MISSING", name);
  11. }
  12. }
  13. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. if (element.getName().equals(CF.CFARGUMENT)) {
  4. final String name = element.getAttributeValue(CF.NAME);
  5. final boolean required = CFTool.toBoolean(element.getAttributeValue(CF.REQUIRED));
  6. final String defaultExpr = element.getAttributeValue(CF.DEFAULT);
  7. if (!required && defaultExpr == null) {
  8. element.getSource().getRow(element.getBegin());
  9. element.getSource().getColumn(element.getBegin());
  10. context.addMessage("ARG_DEFAULT_MISSING", name);
  11. }
  12. }
  13. }

代码示例来源:origin: wala/WALA

  1. public Pair<Integer, String> getBodyText() {
  2. Segment content = innerElement.getContent();
  3. Integer lineNum = innerElement.getSource().getRow(content.getBegin());
  4. String nl = content.getSource().getNewLine();
  5. String body = nl==null? content.toString(): content.toString().replace(nl, "\n");
  6. return Pair.make(lineNum, body);
  7. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. if (element.getName().equals(CF.CFCOMPONENT)) {
  4. final String name = context.getComponentName();
  5. final String nameAttribute = element.getAttributeValue(CF.NAME);
  6. if (nameAttribute != null) {
  7. didYouMeanDisplayName(name, element.getSource().getRow(element.getBegin()), context.offset() + element.getBegin(), context, bugs);
  8. }
  9. }
  10. }

代码示例来源:origin: cflint/CFLint

  1. @Override
  2. public void element(final Element element, final Context context, final BugList bugs) {
  3. if (element.getName().equals(CF.CFCOMPONENT)) {
  4. final String name = context.getComponentName();
  5. final String nameAttribute = element.getAttributeValue(CF.NAME);
  6. if (nameAttribute != null) {
  7. didYouMeanDisplayName(name, element.getSource().getRow(element.getBegin()), context.offset() + element.getBegin(), context, bugs);
  8. }
  9. }
  10. }

代码示例来源:origin: com.ibm.wala/com.ibm.wala.cast.js

  1. public Pair<Integer, String> getBodyText() {
  2. Segment content = innerElement.getContent();
  3. Integer lineNum = innerElement.getSource().getRow(content.getBegin());
  4. String nl = content.getSource().getNewLine();
  5. String body = nl==null? content.toString(): content.toString().replace(nl, "\n");
  6. return Pair.make(lineNum, body);
  7. }

相关文章