当前位置: 首页>>代码示例>>Java>>正文


Java Attribute.setValue方法代码示例

本文整理汇总了Java中org.jsoup.nodes.Attribute.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Attribute.setValue方法的具体用法?Java Attribute.setValue怎么用?Java Attribute.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jsoup.nodes.Attribute的用法示例。


在下文中一共展示了Attribute.setValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testValidProtocol

import org.jsoup.nodes.Attribute; //导入方法依赖的package包/类
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;
}
 
开发者ID:Nader-Sl,项目名称:BoL-API-Parser,代码行数:18,代码来源:Whitelist.java

示例2: processElementNode

import org.jsoup.nodes.Attribute; //导入方法依赖的package包/类
/**
 * Process Element node to check for vue attributes.
 * @param element Current node being processed
 */
private void processElementNode(Element element)
{
    Optional<LocalComponent> localComponent = context.getLocalComponent(element.tagName());

    // Iterate on element attributes
    Set<LocalComponentProp> foundProps = new HashSet<>();
    for (Attribute attribute : element.attributes())
    {
        String attributeName = attribute.getKey().toLowerCase();

        if ("v-for".equals(attributeName) || "v-model".equals(attributeName))
            continue;

        Optional<LocalComponentProp> optionalProp =
            localComponent.flatMap(lc -> lc.getPropForAttribute(attributeName));
        optionalProp.ifPresent(foundProps::add);

        if (!VUE_ATTR_PATTERN.matcher(attributeName).matches())
        {
            optionalProp.ifPresent(this::validateStringPropBinding);
            continue;
        }

        currentAttribute = attribute;
        currentProp = optionalProp.orElse(null);
        currentExpressionReturnType = getExpressionReturnTypeForAttribute(attribute);
        attribute.setValue(processExpression(attribute.getValue()));
    }

    localComponent.ifPresent(lc -> validateRequiredProps(lc, foundProps));
}
 
开发者ID:Axellience,项目名称:vue-gwt,代码行数:36,代码来源:TemplateParser.java

示例3: testValidProtocol

import org.jsoup.nodes.Attribute; //导入方法依赖的package包/类
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;
}
 
开发者ID:cpusoft,项目名称:common,代码行数:29,代码来源:Whitelist.java

示例4: renameAllAttributeValues

import org.jsoup.nodes.Attribute; //导入方法依赖的package包/类
private void renameAllAttributeValues(Element element) {
  Attributes attributes = element.attributes();
  if (attributes != null) {
    for (Attribute attribute : attributes) {
      attribute.setValue(renameStringWithDatabindingDirectives(attribute.getValue()));
    }
  }
}
 
开发者ID:PolymerLabs,项目名称:PolymerRenamer,代码行数:9,代码来源:HtmlRenamer.java

示例5: renameAllAnnotatedEventAttributes

import org.jsoup.nodes.Attribute; //导入方法依赖的package包/类
private void renameAllAnnotatedEventAttributes(Element element) {
  Attributes attributes = element.attributes();
  if (attributes != null) {
    for (Attribute attribute : attributes) {
      String key = attribute.getKey();
      if (key.startsWith("on-")) {
        String renamedEventHandler = renameMap.get(attribute.getValue());
        if (renamedEventHandler != null) {
          attribute.setValue(renamedEventHandler);
        }
      }
    }
  }
}
 
开发者ID:PolymerLabs,项目名称:PolymerRenamer,代码行数:15,代码来源:HtmlRenamer.java

示例6: testValidProtocol

import org.jsoup.nodes.Attribute; //导入方法依赖的package包/类
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;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:29,代码来源:Whitelist.java

示例7: testValidProtocol

import org.jsoup.nodes.Attribute; //导入方法依赖的package包/类
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;
}
 
开发者ID:gumulka,项目名称:JabRefAutocomplete,代码行数:15,代码来源:Whitelist.java


注:本文中的org.jsoup.nodes.Attribute.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。