本文整理汇总了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;
}
示例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));
}
示例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;
}
示例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()));
}
}
}
示例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);
}
}
}
}
}
示例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;
}
示例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;
}