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

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

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

Element.getBegin介绍

暂无

代码示例

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

  1. /**
  2. * 'Detect' if this is a pure cfscript component or interface
  3. *
  4. * @param src
  5. * @param elements
  6. * @return
  7. */
  8. private boolean isComponentOrInterfaceScript(final String src, final List<Element> elements) {
  9. return (src.contains(CF.COMPONENT)
  10. && (elements.isEmpty() || elements.get(0).getBegin() > src.indexOf(CF.COMPONENT)))
  11. || (src.contains(CF.INTERFACE)
  12. && (elements.isEmpty() || elements.get(0).getBegin() > src.indexOf(CF.INTERFACE)));
  13. }

代码示例来源:origin: net.htmlparser.jericho/jericho-html

  1. public int compare(final FormControl formControl1, final FormControl formControl2) {
  2. final int formControl1Begin=formControl1.getElement().getBegin();
  3. final int formControl2Begin=formControl2.getElement().getBegin();
  4. if (formControl1Begin<formControl2Begin) return -1;
  5. if (formControl1Begin>formControl2Begin) return 1;
  6. return 0;
  7. }
  8. }

代码示例来源: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. /**
  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. 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.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: 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. /**
  2. * Parse CF component tag declaration to see if the component 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.CFCOMPONENT)) {
  7. final String name = context.getFilename().replace(".cfc", "");
  8. checkNameForBugs(context, actualFileName(name), context.getFilename(), context.startLine(), element.getBegin(), bugs);
  9. }
  10. }

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

  1. /**
  2. * Parse CF component tag declaration to see if the component 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.CFCOMPONENT)) {
  7. final String name = context.getFilename().replace(".cfc", "");
  8. checkNameForBugs(context, actualFileName(name), context.getFilename(), context.startLine(), element.getBegin(), bugs);
  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.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. @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. public int offset() {
  2. if (element != null) {
  3. if (element.getName().equalsIgnoreCase(CF.CFSCRIPT)) {
  4. return element.getStartTag().getEnd();
  5. } else if (element.getName().equalsIgnoreCase(CF.CFSET)) {
  6. return element.getStartTag().getTagContent().getBegin() + 1;
  7. }
  8. return element.getBegin();
  9. } else {
  10. return 0;
  11. }
  12. }

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

  1. public int offset() {
  2. if (element != null) {
  3. if (element.getName().equalsIgnoreCase(CF.CFSCRIPT)) {
  4. return element.getStartTag().getEnd();
  5. } else if (element.getName().equalsIgnoreCase(CF.CFSET)) {
  6. return element.getStartTag().getTagContent().getBegin() + 1;
  7. }
  8. return element.getBegin();
  9. } else {
  10. return 0;
  11. }
  12. }

代码示例来源: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. }

相关文章