本文整理了Java中net.htmlparser.jericho.Element.getAllElements()
方法的一些代码示例,展示了Element.getAllElements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getAllElements()
方法的具体详情如下:
包路径:net.htmlparser.jericho.Element
类名称:Element
方法名:getAllElements
暂无
代码示例来源:origin: mozilla/zest
public static List<String> getFields(ZestResponse response, int formId) {
List<String> list = new ArrayList<String>();
Source src = new Source(response.getHeaders() + response.getBody());
List<Element> formElements = src.getAllElements(HTMLElementName.FORM);
if (formElements != null && formId < formElements.size()) {
Element form = formElements.get(formId);
List<Element> inputElements = form.getAllElements(HTMLElementName.INPUT);
String field;
for (Element inputElement : inputElements) {
field = inputElement.getAttributeValue("ID");
if (field == null || field.length() == 0) {
field = inputElement.getAttributeValue("NAME");
}
if (field != null && field.length() > 0) {
list.add(field);
}
}
}
return list;
}
}
代码示例来源:origin: net.htmlparser.jericho/jericho-html
public SelectFormControl(final Element element) {
super(element,element.getAttributes().get(Attribute.MULTIPLE)!=null ? FormControlType.SELECT_MULTIPLE : FormControlType.SELECT_SINGLE,false);
final List<Element> optionElements=element.getAllElements(HTMLElementName.OPTION);
optionElementContainers=new ElementContainer[optionElements.size()];
int x=0;
for (Element optionElement : optionElements) {
final ElementContainer optionElementContainer=new ElementContainer(optionElement,true);
if (optionElementContainer.predefinedValue==null)
// use the content of the element if it has no value attribute
optionElementContainer.predefinedValue=CharacterReference.decodeCollapseWhiteSpace(optionElementContainer.element.getContent());
optionElementContainers[x++]=optionElementContainer;
}
}
public String getPredefinedValue() {
代码示例来源:origin: org.zaproxy/zap
List<Element> inputElements = formElement.getAllElements(HTMLElementName.INPUT);
代码示例来源:origin: org.zaproxy/zap
public String getTokenValue(HttpMessage tokenMsg, String tokenName) {
String response = tokenMsg.getResponseHeader().toString() + tokenMsg.getResponseBody().toString();
Source source = new Source(response);
List<Element> formElements = source.getAllElements(HTMLElementName.FORM);
if (formElements != null && formElements.size() > 0) {
// Loop through all of the FORM tags
for (Element formElement : formElements) {
List<Element> inputElements = formElement.getAllElements(HTMLElementName.INPUT);
if (inputElements != null && inputElements.size() > 0) {
// Loop through all of the INPUT elements
for (Element inputElement : inputElements) {
String id = inputElement.getAttributeValue("ID");
if (id != null && id.equalsIgnoreCase(tokenName)) {
return inputElement.getAttributeValue("VALUE");
}
String name = inputElement.getAttributeValue("NAME");
if (name != null && name.equalsIgnoreCase(tokenName)) {
return inputElement.getAttributeValue("VALUE");
}
}
}
}
}
return null;
}
代码示例来源:origin: mozilla/zest
@Override
public String assign(ZestResponse response, ZestRuntime runtime)
throws ZestAssignFailException {
if (response == null) {
throw new ZestAssignFailException(this, "Null response");
}
Source src = new Source(response.getHeaders() + response.getBody());
List<Element> formElements = src.getAllElements(HTMLElementName.FORM);
if (formElements != null && fieldDefinition.getFormIndex() < formElements.size()) {
Element form = formElements.get(fieldDefinition.getFormIndex());
List<Element> inputElements = form.getAllElements(HTMLElementName.INPUT);
for (Element inputElement : inputElements) {
if (fieldDefinition.getFieldName().equals(inputElement.getAttributeValue("ID"))
|| fieldDefinition
.getFieldName()
.equals(inputElement.getAttributeValue("NAME"))) {
// Got it
return inputElement.getAttributeValue("VALUE");
}
}
}
return null;
}
}
代码示例来源:origin: cflint/CFLint
final List<Element> list = elem.getAllElements();
processStack(list.subList(1, list.size()), space + " ", context);
代码示例来源:origin: cflint/CFLint
final List<Element> list = elem.getAllElements();
processStack(list.subList(1, list.size()), space + " ", context);
内容来源于网络,如有侵权,请联系作者删除!