org.apache.abdera.model.Element.setAttributeValue()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(309)

本文整理了Java中org.apache.abdera.model.Element.setAttributeValue()方法的一些代码示例,展示了Element.setAttributeValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.setAttributeValue()方法的具体详情如下:
包路径:org.apache.abdera.model.Element
类名称:Element
方法名:setAttributeValue

Element.setAttributeValue介绍

[英]Sets the value of the named attribute
[中]设置命名属性的值

代码示例

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

  1. public <T extends Element>T setAttributeValue(QName qname, String value) {
  2. internal.setAttributeValue(qname, value);
  3. return (T)this;
  4. }

代码示例来源:origin: org.apache.abdera/abdera-core

  1. public <T extends Element> T setAttributeValue(QName qname, String value) {
  2. internal.setAttributeValue(qname, value);
  3. return (T)this;
  4. }

代码示例来源:origin: org.apache.abdera/abdera-core

  1. public <T extends Element> T setAttributeValue(String name, String value) {
  2. internal.setAttributeValue(name, value);
  3. return (T)this;
  4. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

  1. public <T extends Element>T setAttributeValue(String name, String value) {
  2. internal.setAttributeValue(name, value);
  3. return (T)this;
  4. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera

  1. public StreamBuilder writeAttribute(
  2. String name,
  3. String namespace,
  4. String prefix,
  5. String value) {
  6. if (!(current instanceof Element)) throw new IllegalStateException("Not currently an element");
  7. ((Element)current).setAttributeValue(getQName(name, namespace, prefix), value);
  8. return this;
  9. }

代码示例来源:origin: org.apache.abdera/abdera-core

  1. public StreamBuilder writeAttribute(String name, String namespace, String prefix, String value) {
  2. if (!(current instanceof Element))
  3. throw new IllegalStateException("Not currently an element");
  4. ((Element)current).setAttributeValue(getQName(name, namespace, prefix), value);
  5. return this;
  6. }

代码示例来源:origin: org.apache.abdera/abdera-extensions-main

  1. /**
  2. * Set the value of dir attribute
  3. */
  4. public static <T extends Element> void setDirection(Direction direction, T element) {
  5. if (direction != Direction.UNSPECIFIED)
  6. element.setAttributeValue(DIR, direction.toString().toLowerCase());
  7. else if (direction == Direction.UNSPECIFIED)
  8. element.setAttributeValue(DIR, "");
  9. else if (direction == null)
  10. element.removeAttribute(DIR);
  11. }

代码示例来源:origin: org.apache.abdera/abdera-extensions-geo

  1. private static void setPositionAttributes(Element pos, Position position) {
  2. if (pos != null) {
  3. if (position.getFeatureTypeTag() != null)
  4. pos.setAttributeValue("featuretypetag", position.getFeatureTypeTag());
  5. if (position.getRelationshipTag() != null)
  6. pos.setAttributeValue("relationshiptag", position.getRelationshipTag());
  7. if (position.getElevation() != null)
  8. pos.setAttributeValue("elev", position.getElevation().toString());
  9. if (position.getFloor() != null)
  10. pos.setAttributeValue("floor", position.getFloor().toString());
  11. if (position.getRadius() != null)
  12. pos.setAttributeValue("radius", position.getRadius().toString());
  13. }
  14. }

代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite

  1. @Override
  2. protected void runTest() throws Throwable {
  3. Element element = abdera.getFactory().newElement(new QName("test"));
  4. QName qname = new QName("urn:test", "attr", "p");
  5. element.setAttributeValue(qname, "value");
  6. assertThat(element.getAttributes()).containsExactly(qname);
  7. element.setAttributeValue(qname, null);
  8. assertThat(element.getAttributes()).isEmpty();
  9. }
  10. }

代码示例来源:origin: org.apache.abdera/abdera-parser

  1. public Collection addAccepts(Map<String, String> mediaRanges) {
  2. complete();
  3. if (mediaRanges != null) {
  4. for (Map.Entry<String, String> entry : mediaRanges.entrySet()) {
  5. if (!accepts(entry.getKey())) {
  6. try {
  7. Element accept = addSimpleExtension(ACCEPT, new MimeType(entry.getKey()).toString());
  8. if (entry.getValue() != null) {
  9. accept.setAttributeValue(ALTERNATE, entry.getValue());
  10. }
  11. } catch (Exception e) {
  12. }
  13. }
  14. }
  15. }
  16. return this;
  17. }
  18. }

代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite

  1. @Override
  2. protected void runTest() throws Throwable {
  3. Element element = abdera.getFactory().newElement(new QName("test"));
  4. element.setAttributeValue(qname, "value");
  5. assertThat(element.getAttributeValue(qname)).isEqualTo("value");
  6. List<QName> attrs = element.getAttributes();
  7. assertThat(attrs).hasSize(1);
  8. QName actualQName = attrs.get(0);
  9. assertThat(actualQName).isEqualTo(qname);
  10. assertThat(actualQName.getPrefix()).isEqualTo(qname.getPrefix());
  11. }
  12. }

代码示例来源:origin: org.apache.ws.commons.axiom/fom-testsuite

  1. @Override
  2. protected void runTest() throws Throwable {
  3. Factory factory = abdera.getFactory();
  4. Element element = factory.newElement(new QName("test"));
  5. element.setAttributeValue("attr", "value");
  6. Object xpathResult = abdera.getXPath().selectSingleNode("./@attr", element);
  7. assertThat(xpathResult).isInstanceOf(Attribute.class);
  8. assertThat(((Attribute)xpathResult).getFactory()).isSameAs(factory);
  9. }
  10. }

代码示例来源:origin: org.apache.abdera/abdera-parser

  1. public Collection setAccept(Map<String, String> mediaRanges) {
  2. complete();
  3. if (mediaRanges != null && mediaRanges.size() > 0) {
  4. _removeChildren(ACCEPT, true);
  5. _removeChildren(PRE_RFC_ACCEPT, true);
  6. if (mediaRanges.size() == 1 && mediaRanges.keySet().iterator().next().equals("")) {
  7. addExtension(ACCEPT);
  8. } else {
  9. for (Map.Entry<String, String> entry : mediaRanges.entrySet()) {
  10. if (entry.getKey().equalsIgnoreCase("entry")) {
  11. addSimpleExtension(ACCEPT, "application/atom+xml;type=entry");
  12. } else {
  13. try {
  14. Element accept = addSimpleExtension(ACCEPT, new MimeType(entry.getKey()).toString());
  15. if (entry.getValue() != null) {
  16. accept.setAttributeValue(ALTERNATE, entry.getValue());
  17. }
  18. } catch (javax.activation.MimeTypeParseException e) {
  19. throw new org.apache.abdera.util.MimeTypeParseException(e);
  20. }
  21. }
  22. }
  23. }
  24. } else {
  25. _removeChildren(ACCEPT, true);
  26. _removeChildren(PRE_RFC_ACCEPT, true);
  27. }
  28. return this;
  29. }

相关文章