本文整理了Java中net.htmlparser.jericho.Element.getChildElements()
方法的一些代码示例,展示了Element.getChildElements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getChildElements()
方法的具体详情如下:
包路径:net.htmlparser.jericho.Element
类名称:Element
方法名:getChildElements
[英]Returns a list of the immediate children of this element in the document element hierarchy.
The objects in the list are all of type Element.
See the Source#getChildElements() method for more details.
[中]返回文档元素层次结构中此元素的直接子元素列表。
列表中的对象都是Element类型。
有关详细信息,请参阅源代码#getChildElements()方法。
代码示例来源:origin: net.htmlparser.jericho/jericho-html
/**
* Returns a list of the immediate children of this element in the document element hierarchy.
* <p>
* The objects in the list are all of type {@link Element}.
* <p>
* See the {@link Source#getChildElements()} method for more details.
*
* @return a list of the immediate children of this element in the document element hierarchy, guaranteed not <code>null</code>.
* @see #getParentElement()
*/
@Override public final List<Element> getChildElements() {
return childElements!=null ? childElements : getChildElements(-1);
}
代码示例来源: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: VueGWT/vue-gwt
&& !(segment instanceof CharacterReference))
.filter(segment -> {
for (Element child : element.getChildElements()) {
if (child.encloses(segment)) {
return false;
element.getChildElements().
forEach(this::processElement);
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
final String tagName = element.getName();
if (tagName.equalsIgnoreCase(CFML_TAG_CHECK)) {
boolean isDefault = false;
for (final Element el : element.getChildElements()) {
// decide if default was provided
if (el.getName().equalsIgnoreCase(CFML_TAG_REQUIRED)) {
// default found, so reassign and break
isDefault = true;
break;
}
}
if (!isDefault) { // no default found
context.addMessage(MESSAGE_CODE, null);
}
}
}
}
代码示例来源:origin: cflint/CFLint
@Override
public void element(final Element element, final Context context, final BugList bugs) {
final String tagName = element.getName();
if (tagName.equalsIgnoreCase(CFML_TAG_CHECK)) {
boolean isDefault = false;
for (final Element el : element.getChildElements()) {
// decide if default was provided
if (el.getName().equalsIgnoreCase(CFML_TAG_REQUIRED)) {
// default found, so reassign and break
isDefault = true;
break;
}
}
if (!isDefault) { // no default found
context.addMessage(MESSAGE_CODE, null);
}
}
}
}
代码示例来源:origin: net.htmlparser.jericho/jericho-html
private void appendElementContent(final Element element) throws IOException {
final int contentEnd=element.getContentEnd();
if (element.isEmpty() || renderedIndex>=contentEnd) return;
final int contentBegin=element.getStartTag().end;
appendSegmentProcessingChildElements(Math.max(renderedIndex,contentBegin),contentEnd,element.getChildElements());
}
代码示例来源:origin: cflint/CFLint
/**
* Returns the previous sibling of a given element
*
* @param element
* The Jericho HTML element object
* @return the previous sibling of the given element.
*/
public static Element getPreviousSibling(final Element element) {
if (element.getParentElement() != null) {
final List<Element> parentElements = element.getParentElement().getChildElements();
final int idx = parentElements.indexOf(element);
if (idx > 0) {
return parentElements.get(idx - 1);
}
} else if (element.getSource() != null) {
final List<Element> parentElements = element.getSource().getChildElements();
final int idx = parentElements.indexOf(element);
if (idx > 0) {
return parentElements.get(idx - 1);
}
}
return null;
}
代码示例来源:origin: cflint/CFLint
/**
* Returns the previous sibling of a given element
*
* @param element
* The Jericho HTML element object
* @return the previous sibling of the given element.
*/
public static Element getPreviousSibling(final Element element) {
if (element.getParentElement() != null) {
final List<Element> parentElements = element.getParentElement().getChildElements();
final int idx = parentElements.indexOf(element);
if (idx > 0) {
return parentElements.get(idx - 1);
}
} else if (element.getSource() != null) {
final List<Element> parentElements = element.getSource().getChildElements();
final int idx = parentElements.indexOf(element);
if (idx > 0) {
return parentElements.get(idx - 1);
}
}
return null;
}
代码示例来源:origin: cflint/CFLint
/**
* Determine the line numbers of the <!--- @CFLintIgnore CFQUERYPARAM_REQ ---> tags
* Both the current and the next line are included.
*
* @param element the element object
* @return the line numbers of any @@CFLintIgnore annotations.
*/
private List<Integer> determineIgnoreLines(final Element element) {
final List<Integer> ignoreLines = new ArrayList<>();
for (Element comment : element.getChildElements()) {
if ("!---".equals(comment.getName()) && comment.toString().contains("@CFLintIgnore") && comment.toString().contains("CFQUERYPARAM_REQ")) {
int ignoreLine = comment.getSource().getRow(comment.getEnd());
ignoreLines.add(ignoreLine);
ignoreLines.add(ignoreLine + 1);
ignoreLines.add(comment.getSource().getRow(comment.getBegin()));
} else {
ignoreLines.addAll(determineIgnoreLines(comment));
}
}
return ignoreLines;
}
代码示例来源:origin: cflint/CFLint
/**
* Determine the line numbers of the <!--- @CFLintIgnore CFQUERYPARAM_REQ ---> tags
* Both the current and the next line are included.
*
* @param element the element object
* @return the line numbers of any @@CFLintIgnore annotations.
*/
private List<Integer> determineIgnoreLines(final Element element) {
final List<Integer> ignoreLines = new ArrayList<>();
for (Element comment : element.getChildElements()) {
if ("!---".equals(comment.getName()) && comment.toString().contains("@CFLintIgnore") && comment.toString().contains("CFQUERYPARAM_REQ")) {
int ignoreLine = comment.getSource().getRow(comment.getEnd());
ignoreLines.add(ignoreLine);
ignoreLines.add(ignoreLine + 1);
ignoreLines.add(comment.getSource().getRow(comment.getBegin()));
} else {
ignoreLines.addAll(determineIgnoreLines(comment));
}
}
return ignoreLines;
}
代码示例来源:origin: net.htmlparser.jericho/jericho-html
childElement.getChildElements();
pos=childElement.end;
代码示例来源:origin: net.htmlparser.jericho/jericho-html
childElement.getChildElements(0);
if (childElement.parentElement==Element.NOT_CACHED) { // make sure element was not added as a child of a descendent element (can happen with overlapping elements)
childElement.parentElement=null;
代码示例来源:origin: wala/WALA
private void parse(Element root) {
JerichoTag tag = new JerichoTag(root, fileName);
handler.handleStartTag(tag);
handler.handleText(tag.getElementPosition(), tag.getBodyText().snd);
List<Element> childElements = root.getChildElements();
for (Element child : childElements) {
parse(child);
}
handler.handleEndTag(tag);
}
代码示例来源:origin: com.ibm.wala/com.ibm.wala.cast.js
private void parse(Element root) {
JerichoTag tag = new JerichoTag(root, fileName);
handler.handleStartTag(tag);
handler.handleText(tag.getElementPosition(), tag.getBodyText().snd);
List<Element> childElements = root.getChildElements();
for (Element child : childElements) {
parse(child);
}
handler.handleEndTag(tag);
}
代码示例来源:origin: net.htmlparser.jericho/jericho-html
childElement.getChildElements(childDepth);
if (childElement.parentElement==Element.NOT_CACHED) { // make sure element was not added as a child of a descendent element (can happen with overlapping elements)
childElement.parentElement=this;
代码示例来源:origin: com.github.cfparser/cfml.parsing
} else {
for (Element child : elem.getChildElements()) {
visit(child, level + 1, visitor);
代码示例来源:origin: cflint/CFLint
processStack(elem.getChildElements(), space + " ", context);
processStack(elem.getChildElements(), space + " ", context);
} else if (elem.getName().equalsIgnoreCase(CF.CFSCRIPT)) {
scanElement(elem, context);
processStack(elem.getChildElements(), space + " ", context);
} else if (elem.getName().equalsIgnoreCase(CF.CFFUNCTION)) {
final Context functionContext = context.subContext(elem);
functionContext.setContextType(ContextType.FUNCTION);
scanElement(elem, functionContext);
processStack(elem.getChildElements(), space + " ", functionContext);
processStack(elem.getChildElements(), space + " ", componentContext);
for (final CFLintStructureListener structurePlugin : getStructureListeners(extensions)) {
try {
processStack(elem.getChildElements(), space + " ", context);
handler.pop();
} else if (elem.getName().equalsIgnoreCase(CF.CFCATCH)) {
processStack(elem.getChildElements(), space + " ", context);
handler.pop();
} else {
processStack(elem.getChildElements(), space + " ", context);
代码示例来源:origin: cflint/CFLint
processStack(elem.getChildElements(), space + " ", context);
processStack(elem.getChildElements(), space + " ", context);
} else if (elem.getName().equalsIgnoreCase(CF.CFSCRIPT)) {
scanElement(elem, context);
processStack(elem.getChildElements(), space + " ", context);
} else if (elem.getName().equalsIgnoreCase(CF.CFFUNCTION)) {
final Context functionContext = context.subContext(elem);
functionContext.setContextType(ContextType.FUNCTION);
scanElement(elem, functionContext);
processStack(elem.getChildElements(), space + " ", functionContext);
processStack(elem.getChildElements(), space + " ", componentContext);
for (final CFLintStructureListener structurePlugin : getStructureListeners(extensions)) {
try {
processStack(elem.getChildElements(), space + " ", context);
handler.pop();
} else if (elem.getName().equalsIgnoreCase(CF.CFCATCH)) {
processStack(elem.getChildElements(), space + " ", context);
handler.pop();
} else {
processStack(elem.getChildElements(), space + " ", context);
代码示例来源:origin: net.htmlparser.jericho/jericho-html
appendContent(contentEnd,element.getChildElements(),depth+1);
内容来源于网络,如有侵权,请联系作者删除!