Exemplo n.º 1
0
 public XmlAttribute setAttribute(String name, String namespace, String value)
     throws IncorrectOperationException {
   if (!Comparing.equal(namespace, "")) {
     final String prefix = getPrefixByNamespace(namespace);
     if (prefix != null && prefix.length() > 0) name = prefix + ":" + name;
   }
   return setAttribute(name, value);
 }
Exemplo n.º 2
0
  @Nullable
  public XmlAttribute getAttribute(String qname) {
    if (qname == null) return null;
    final XmlAttribute[] attributes = getAttributes();

    final boolean caseSensitive = isCaseSensitive();

    for (final XmlAttribute attribute : attributes) {
      final LeafElement attrNameElement =
          (LeafElement) XmlChildRole.ATTRIBUTE_NAME_FINDER.findChild(attribute.getNode());
      if (attrNameElement != null
          && (caseSensitive && Comparing.equal(attrNameElement.getChars(), qname)
              || !caseSensitive && Comparing.equal(attrNameElement.getChars(), qname, false))) {
        return attribute;
      }
    }
    return null;
  }