本文整理匯總了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()));
}
}