下面列出了org.jsoup.nodes.Attribute#setValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private boolean testValidProtocol(Element el, Attribute attr, Set<Protocol> protocols) {
// try to resolve relative urls to abs, and optionally update the attribute so output html has abs.
// rels without a baseuri get removed
String value = el.absUrl(attr.getKey());
if (value.length() == 0)
value = attr.getValue(); // if it could not be made abs, run as-is to allow custom unknown protocols
if (!preserveRelativeLinks)
attr.setValue(value);
for (Protocol protocol : protocols) {
String prot = protocol.toString() + ":";
if (value.toLowerCase().startsWith(prot)) {
return true;
}
}
return false;
}
private boolean testValidProtocol(Element el, Attribute attr, Set<Protocol> protocols) {
// try to resolve relative urls to abs, and optionally update the attribute so output html has abs.
// rels without a baseuri get removed
String value = el.absUrl(attr.getKey());
if (value.length() == 0)
value = attr.getValue(); // if it could not be made abs, run as-is to allow custom unknown protocols
if (!preserveRelativeLinks)
attr.setValue(value);
for (Protocol protocol : protocols) {
String prot = protocol.toString();
if (prot.equals("#")) { // allows anchor links
if (isValidAnchor(value)) {
return true;
} else {
continue;
}
}
prot += ":";
if (value.toLowerCase().startsWith(prot)) {
return true;
}
}
return false;
}
private boolean testValidProtocol(Element el, Attribute attr, Set<Protocol> protocols) {
// try to resolve relative urls to abs, and optionally update the attribute so output html has abs.
// rels without a baseuri get removed
String value = el.absUrl(attr.getKey());
if (value.length() == 0)
value = attr.getValue(); // if it could not be made abs, run as-is to allow custom unknown protocols
if (!preserveRelativeLinks)
attr.setValue(value);
for (Protocol protocol : protocols) {
String prot = protocol.toString();
if (prot.equals("#")) { // allows anchor links
if (isValidAnchor(value)) {
return true;
} else {
continue;
}
}
prot += ":";
if (lowerCase(value).startsWith(prot)) {
return true;
}
}
return false;
}
private boolean testValidProtocol(Element el, Attribute attr, Set<Protocol> protocols) {
// try to resolve relative urls to abs, and optionally update the attribute so output html has abs.
// rels without a baseuri get removed
String value = el.absUrl(attr.getKey());
if (value.length() == 0)
value = attr.getValue(); // if it could not be made abs, run as-is to allow custom unknown protocols
if (!preserveRelativeLinks)
attr.setValue(value);
for (Protocol protocol : protocols) {
String prot = protocol.toString();
if (prot.equals("#")) { // allows anchor links
if (isValidAnchor(value)) {
return true;
} else {
continue;
}
}
prot += ":";
if (lowerCase(value).startsWith(prot)) {
return true;
}
}
return false;
}
private boolean testValidProtocol(Element el, Attribute attr, Set<Protocol> protocols) {
// resolve relative urls to abs, and update the attribute so output html has abs.
// rels without a baseuri get removed
String value = el.absUrl(attr.getKey());
attr.setValue(value);
for (Protocol protocol : protocols) {
String prot = protocol.toString() + ":";
if (value.toLowerCase().startsWith(prot)) {
return true;
}
}
return false;
}
/**
* Expand color codes in attribute value.
*
* @param attribute attribute
*/
private static void expandColorCodeInAttribute(Attribute attribute) {
attribute.setValue(expandColorCode(attribute.getValue()));
}