本文整理了Java中org.apache.abdera.model.Element.setAttributeValue()
方法的一些代码示例,展示了Element.setAttributeValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.setAttributeValue()
方法的具体详情如下:
包路径:org.apache.abdera.model.Element
类名称:Element
方法名:setAttributeValue
[英]Sets the value of the named attribute
[中]设置命名属性的值
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
public <T extends Element>T setAttributeValue(QName qname, String value) {
internal.setAttributeValue(qname, value);
return (T)this;
}
代码示例来源:origin: org.apache.abdera/abdera-core
public <T extends Element> T setAttributeValue(QName qname, String value) {
internal.setAttributeValue(qname, value);
return (T)this;
}
代码示例来源:origin: org.apache.abdera/abdera-core
public <T extends Element> T setAttributeValue(String name, String value) {
internal.setAttributeValue(name, value);
return (T)this;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
public <T extends Element>T setAttributeValue(String name, String value) {
internal.setAttributeValue(name, value);
return (T)this;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
public StreamBuilder writeAttribute(
String name,
String namespace,
String prefix,
String value) {
if (!(current instanceof Element)) throw new IllegalStateException("Not currently an element");
((Element)current).setAttributeValue(getQName(name, namespace, prefix), value);
return this;
}
代码示例来源:origin: org.apache.abdera/abdera-core
public StreamBuilder writeAttribute(String name, String namespace, String prefix, String value) {
if (!(current instanceof Element))
throw new IllegalStateException("Not currently an element");
((Element)current).setAttributeValue(getQName(name, namespace, prefix), value);
return this;
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-main
/**
* Set the value of dir attribute
*/
public static <T extends Element> void setDirection(Direction direction, T element) {
if (direction != Direction.UNSPECIFIED)
element.setAttributeValue(DIR, direction.toString().toLowerCase());
else if (direction == Direction.UNSPECIFIED)
element.setAttributeValue(DIR, "");
else if (direction == null)
element.removeAttribute(DIR);
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-geo
private static void setPositionAttributes(Element pos, Position position) {
if (pos != null) {
if (position.getFeatureTypeTag() != null)
pos.setAttributeValue("featuretypetag", position.getFeatureTypeTag());
if (position.getRelationshipTag() != null)
pos.setAttributeValue("relationshiptag", position.getRelationshipTag());
if (position.getElevation() != null)
pos.setAttributeValue("elev", position.getElevation().toString());
if (position.getFloor() != null)
pos.setAttributeValue("floor", position.getFloor().toString());
if (position.getRadius() != null)
pos.setAttributeValue("radius", position.getRadius().toString());
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite
@Override
protected void runTest() throws Throwable {
Element element = abdera.getFactory().newElement(new QName("test"));
QName qname = new QName("urn:test", "attr", "p");
element.setAttributeValue(qname, "value");
assertThat(element.getAttributes()).containsExactly(qname);
element.setAttributeValue(qname, null);
assertThat(element.getAttributes()).isEmpty();
}
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public Collection addAccepts(Map<String, String> mediaRanges) {
complete();
if (mediaRanges != null) {
for (Map.Entry<String, String> entry : mediaRanges.entrySet()) {
if (!accepts(entry.getKey())) {
try {
Element accept = addSimpleExtension(ACCEPT, new MimeType(entry.getKey()).toString());
if (entry.getValue() != null) {
accept.setAttributeValue(ALTERNATE, entry.getValue());
}
} catch (Exception e) {
}
}
}
}
return this;
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite
@Override
protected void runTest() throws Throwable {
Element element = abdera.getFactory().newElement(new QName("test"));
element.setAttributeValue(qname, "value");
assertThat(element.getAttributeValue(qname)).isEqualTo("value");
List<QName> attrs = element.getAttributes();
assertThat(attrs).hasSize(1);
QName actualQName = attrs.get(0);
assertThat(actualQName).isEqualTo(qname);
assertThat(actualQName.getPrefix()).isEqualTo(qname.getPrefix());
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite
@Override
protected void runTest() throws Throwable {
Factory factory = abdera.getFactory();
Element element = factory.newElement(new QName("test"));
element.setAttributeValue("attr", "value");
Object xpathResult = abdera.getXPath().selectSingleNode("./@attr", element);
assertThat(xpathResult).isInstanceOf(Attribute.class);
assertThat(((Attribute)xpathResult).getFactory()).isSameAs(factory);
}
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public Collection setAccept(Map<String, String> mediaRanges) {
complete();
if (mediaRanges != null && mediaRanges.size() > 0) {
_removeChildren(ACCEPT, true);
_removeChildren(PRE_RFC_ACCEPT, true);
if (mediaRanges.size() == 1 && mediaRanges.keySet().iterator().next().equals("")) {
addExtension(ACCEPT);
} else {
for (Map.Entry<String, String> entry : mediaRanges.entrySet()) {
if (entry.getKey().equalsIgnoreCase("entry")) {
addSimpleExtension(ACCEPT, "application/atom+xml;type=entry");
} else {
try {
Element accept = addSimpleExtension(ACCEPT, new MimeType(entry.getKey()).toString());
if (entry.getValue() != null) {
accept.setAttributeValue(ALTERNATE, entry.getValue());
}
} catch (javax.activation.MimeTypeParseException e) {
throw new org.apache.abdera.util.MimeTypeParseException(e);
}
}
}
}
} else {
_removeChildren(ACCEPT, true);
_removeChildren(PRE_RFC_ACCEPT, true);
}
return this;
}
内容来源于网络,如有侵权,请联系作者删除!