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

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

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

Element.getAttributeValue介绍

[英]Returns the value of the named attribute
[中]返回命名属性的值

代码示例

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

public String getAttributeValue(String name) {
  return internal.getAttributeValue(name);
}

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

public String getAttributeValue(String name) {
 return internal.getAttributeValue(name);
}

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

public String getAttributeValue(QName qname) {
  return internal.getAttributeValue(qname);
}

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

public String getAttributeValue(QName qname) {
 return internal.getAttributeValue(qname);
}

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

protected boolean isMatch(Element el) {
    if (attribute != null) {
      String val = el.getAttributeValue(attribute);
      return ((val == null && value == null) || (val == null && value != null && value.equals(defaultValue)) || (val != null && val
        .equals(value)));
    }
    return true;
  }
}

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

protected boolean isMatch(Element el) {
    if (attribute != null) {
      String val = FOMLink.getRelEquiv(el.getAttributeValue(attribute));
      return ((val == null && value == null) || (val == null && value != null && value
        .equalsIgnoreCase(defaultValue)) || (val != null && val.equalsIgnoreCase(value)));
    }
    return true;
  }
}

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

public Map<String, String> getAcceptMultiparted() {
  Map<String, String> accept = new HashMap<String, String>();
  Iterator<?> i = getChildrenWithName(ACCEPT);
  if (i == null || !i.hasNext())
    i = getChildrenWithName(PRE_RFC_ACCEPT);
  while (i.hasNext()) {
    Element e = (Element)i.next();
    String t = e.getText();
    if (t != null) {
      if (e.getAttributeValue(ALTERNATE) != null && e.getAttributeValue(ALTERNATE).trim().length() > 0) {
        accept.put(t.trim(), e.getAttributeValue(ALTERNATE));
      } else {
        accept.put(t.trim(), null);
      }
    }
  }
  return accept;
}

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

private static void getPositionAttributes(Element pos, Position position) {
  if (position != null) {
    String featuretypetag = pos.getAttributeValue("featuretypetag");
    String relationshiptag = pos.getAttributeValue("relationshiptag");
    String elevation = pos.getAttributeValue("elev");
    String floor = pos.getAttributeValue("floor");
    String radius = pos.getAttributeValue("radius");
    if (featuretypetag != null)
      position.setFeatureTypeTag(featuretypetag);
    if (featuretypetag != null)
      position.setRelationshipTag(relationshiptag);
    if (elevation != null)
      position.setElevation(Double.valueOf(elevation));
    if (floor != null)
      position.setFloor(Double.valueOf(floor));
    if (radius != null)
      position.setRadius(Double.valueOf(radius));
  }
}

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

@Override
public String getLanguage() {
  if (Type.XHTML.equals(type)) {
    Element el = getValueElement();
    if (el != null && el.getAttributeValue(LANG) != null)
      return el.getAttributeValue(LANG);
  }
  return super.getLanguage();
}

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

@Override
public String getLanguage() {
  if (Type.XHTML.equals(type)) {
    Element el = getValueElement();
    if (el.getAttributeValue(LANG) != null)
      return el.getAttributeValue(LANG);
  }
  return super.getLanguage();
}

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

private static <T extends Element> boolean hasDirection(T element) {
    String dir = element.getAttributeValue("dir");
    if (dir != null && dir.length() > 0)
      return true;
    else if (dir == null) {
      // if the direction is unspecified on this element,
      // let's see if we've inherited it
      Base parent = element.getParentElement();
      if (parent != null && parent instanceof Element)
        return hasDirection((Element)parent);
    }
    return false;
  }
}

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

/**
 * Return the text content of the specified attribute using the in-scope directionality
 * 
 * @param element The parent element
 * @param name the name of the attribute
 * @return The directionally-wrapped text of the attribute
 */
public static <T extends Element> String getBidiAttributeValue(T element, String name) {
  return getBidiText(getDirection(element), element.getAttributeValue(name));
}

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

/**
 * Return the text content of the specified attribute using the in-scope directionality
 * 
 * @param element The parent element
 * @param name the name of the attribute
 * @return The directionally-wrapped text of the attribute
 */
public static <T extends Element> String getBidiAttributeValue(T element, QName name) {
  return getBidiText(getDirection(element), element.getAttributeValue(name));
}

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

@Override
public IRI getResolvedBaseUri() {
  if (Type.XHTML.equals(type)) {
    Element el = getValueElement();
    if (el != null) {
      if (el.getAttributeValue(BASE) != null) {
        return super.getResolvedBaseUri().resolve(el.getAttributeValue(BASE));
      }
    }
  }
  return super.getResolvedBaseUri();
}

代码示例来源: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.abdera/abdera-parser

@Override
public IRI getResolvedBaseUri() {
  if (Type.XHTML.equals(type)) {
    Element el = getValueElement();
    if (el != null) {
      if (el.getAttributeValue(BASE) != null) {
        return super.getResolvedBaseUri().resolve(el.getAttributeValue(BASE));
      }
    }
  }
  return super.getResolvedBaseUri();
}

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

/**
 * Get the in-scope direction for an element.
 */
public static <T extends Element> Direction getDirection(T element) {
  Direction direction = Direction.UNSPECIFIED;
  String dir = element.getAttributeValue("dir");
  if (dir != null && dir.length() > 0)
    direction = Direction.valueOf(dir.toUpperCase());
  else if (dir == null) {
    // if the direction is unspecified on this element,
    // let's see if we've inherited it
    Base parent = element.getParentElement();
    if (parent != null && parent instanceof Element)
      direction = getDirection((Element)parent);
  }
  return direction;
}

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

@Override
public IRI getBaseUri() {
  if (Type.XHTML.equals(type)) {
    Element el = getValueElement();
    if (el != null) {
      if (el.getAttributeValue(BASE) != null) {
        if (getAttributeValue(BASE) != null)
          return super.getBaseUri().resolve(el.getAttributeValue(BASE));
        else
          return _getUriValue(el.getAttributeValue(BASE));
      }
    }
  }
  return super.getBaseUri();
}

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

@Override
public IRI getBaseUri() {
  if (Type.XHTML.equals(type)) {
    Element el = getValueElement();
    if (el != null) {
      if (el.getAttributeValue(BASE) != null) {
        if (getAttributeValue(BASE) != null)
          return super.getBaseUri().resolve(el.getAttributeValue(BASE));
        else
          return _getUriValue(el.getAttributeValue(BASE));
      }
    }
  }
  return super.getBaseUri();
}

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

protected void process(Object source,
            ObjectContext objectContext,
            SerializationContext context,
            Conventions conventions) {
  StreamWriter sw = context.getStreamWriter();
  if (!(source instanceof Element))
    return;
  Element element = (Element)source;
  sw.startElement(element.getQName());
  for (QName attr : element.getAttributes())
    sw.writeAttribute(attr, element.getAttributeValue(attr));
  XPath xpath = context.getAbdera().getXPath();
  List<?> children = xpath.selectNodes("node()", element);
  for (Object child : children) {
    if (child instanceof Element) {
      process(child, new ObjectContext(child), context, conventions);
    } else if (child instanceof Comment) {
      Comment comment = (Comment)child;
      sw.writeComment(comment.getText());
    } else if (child instanceof ProcessingInstruction) {
      ProcessingInstruction pi = (ProcessingInstruction)child;
      sw.writePI(pi.getText(), pi.getTarget());
    } else if (child instanceof TextValue) {
      TextValue tv = (TextValue)child;
      sw.writeElementText(tv.getText());
    }
  }
  sw.endElement();
}

相关文章