本文整理汇总了Java中org.jsoup.nodes.Element.attributes方法的典型用法代码示例。如果您正苦于以下问题:Java Element.attributes方法的具体用法?Java Element.attributes怎么用?Java Element.attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jsoup.nodes.Element
的用法示例。
在下文中一共展示了Element.attributes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isIllegalStringInTag
import org.jsoup.nodes.Element; //导入方法依赖的package包/类
private boolean isIllegalStringInTag(final Element tag){
final String[] illegalWords = {"advert", "werbung", "anzeige", "adsense"};
if (tag == null){
return false;
}
for (final String word : illegalWords) {
final Attributes tagAttrs = tag.attributes();
if (tagAttrs != null){
for(final Attribute attr : tagAttrs){
if(attr.toString().toLowerCase().contains(word.toLowerCase())){
return true;
}
}
}else{
return false;
}
}
return false;
}
示例2: readDesign
import org.jsoup.nodes.Element; //导入方法依赖的package包/类
@Override
public void readDesign(Element design, DesignContext designContext) {
super.readDesign(design, designContext);
for (Element child : design.children()) {
Component childComponent = designContext.readDesign(child);
if (!(childComponent instanceof Step)) {
throw new IllegalArgumentException("Only implementations of " + Step.class.getName() +
" are allowed as children of " + getClass().getName());
}
stepIterator.add(((Step) childComponent));
}
boolean linear = false;
Attributes attributes = design.attributes();
if (attributes.hasKey(DESIGN_ATTRIBUTE_LINEAR)) {
linear = DesignAttributeHandler.getFormatter()
.parse(design.attr(DESIGN_ATTRIBUTE_LINEAR), Boolean.class);
}
stepIterator.setLinear(linear);
}
示例3: handle
import org.jsoup.nodes.Element; //导入方法依赖的package包/类
@Override
public void handle(boolean allAttr, String attrKey, Element element, List<SIPNode> ret) {
if (allAttr) {
for (Attribute attribute : element.attributes()) {
ret.add(SIPNode.t(element.absUrl(attribute.getKey())));
}
} else {
String value = element.absUrl(attrKey);
if (StringUtils.isNotBlank(value)) {
ret.add(SIPNode.t(value));
}
}
}
示例4: readDesign
import org.jsoup.nodes.Element; //导入方法依赖的package包/类
@Override
public void readDesign(Element design, DesignContext designContext) {
super.readDesign(design, designContext);
Attributes attr = design.attributes();
if (design.hasAttr("time-zone")) {
setZoneId(ZoneId.of(DesignAttributeHandler.readAttribute("end-date", attr, String.class)));
}
if (design.hasAttr("time-format")) {
setTimeFormat(TimeFormat.valueOf(
"Format" + design.attr("time-format").toUpperCase()));
}
if (design.hasAttr("start-date")) {
setStartDate(
ZonedDateTime.ofInstant(DesignAttributeHandler.readAttribute("start-date", attr, Date.class)
.toInstant(), getZoneId()));
}
if (design.hasAttr("end-date")) {
setEndDate(
ZonedDateTime.ofInstant(DesignAttributeHandler.readAttribute("end-date", attr, Date.class)
.toInstant(), getZoneId()));
}
}