org.jsoup.nodes.Attribute#setValue ( )源码实例Demo

下面列出了org.jsoup.nodes.Attribute#setValue ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jsoup-learning   文件: Whitelist.java
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;
}
 
源代码2 项目: astor   文件: Whitelist.java
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;
}
 
源代码3 项目: astor   文件: Whitelist.java
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;
}
 
源代码4 项目: astor   文件: Whitelist.java
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;
}
 
源代码5 项目: es   文件: SishuokWhitelist.java
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;
}
 
源代码6 项目: openemm   文件: ColorCodeCorrector.java
/**
 * Expand color codes in attribute value.
 * 
 * @param attribute attribute
 */
private static void expandColorCodeInAttribute(Attribute attribute) {
	attribute.setValue(expandColorCode(attribute.getValue()));
}
 
 方法所在类
 同类方法