Package org.dom4j

Examples of org.dom4j.Attribute


  protected Attribute attribute(String namespaceURI, String localName) {
    List attributes = attributeList();
    int size = attributes.size();

    for (int i = 0; i < size; i++) {
      Attribute attribute = (Attribute) attributes.get(i);

      if (localName.equals(attribute.getName())
          && (((namespaceURI == null || namespaceURI.length() == 0)
          && ((attribute.getNamespaceURI() == null)
          || (attribute.getNamespaceURI().length() == 0)))
          || ((namespaceURI != null) && namespaceURI
          .equals(attribute.getNamespaceURI())))) {
        return attribute;
      }
    }

    return null;
View Full Code Here


    public boolean hasNext() {
      return iter.hasNext();
    }

    public Object next() {
      Attribute attr = (Attribute) iter.next();
      QName attrName = createQName(attr.getQName());
      String value = attr.getValue();

      return factory.createAttribute(attrName, value);
    }
View Full Code Here

            Element e = (Element)node;
            if(localName == null) {
                result.addAll(e.attributes());
            }
            else {
                Attribute attr = e.attribute(e.getQName().getDocumentFactory().createQName(localName, "", namespaceUri));
                if(attr != null) {
                    result.add(attr);
                }
            }
        }
View Full Code Here

    return (element != null) ? element.attributeCount() : 0;
  }

  public String getAttributeNamespaceUri(int index) {
    if (element != null) {
      Attribute attribute = element.attribute(index);

      if (attribute != null) {
        return attribute.getNamespaceURI();
      }
    }

    return null;
  }
View Full Code Here

    return null;
  }

  public String getAttributeLocalName(int index) {
    if (element != null) {
      Attribute attribute = element.attribute(index);

      if (attribute != null) {
        return attribute.getName();
      }
    }

    return null;
  }
View Full Code Here

    return null;
  }

  public String getAttributePrefix(int index) {
    if (element != null) {
      Attribute attribute = element.attribute(index);

      if (attribute != null) {
        String prefix = attribute.getNamespacePrefix();

        if ((prefix != null) && (prefix.length() > 0)) {
          return prefix;
        }
      }
View Full Code Here

    return null;
  }

  public String getAttributeRawName(int index) {
    if (element != null) {
      Attribute attribute = element.attribute(index);

      if (attribute != null) {
        return attribute.getQualifiedName();
      }
    }

    return null;
  }
View Full Code Here

    return null;
  }

  public String getAttributeValue(int index) {
    if (element != null) {
      Attribute attribute = element.attribute(index);

      if (attribute != null) {
        return attribute.getValue();
      }
    }

    return null;
  }
View Full Code Here

  }

  public String getAttributeValueFromRawName(String rawName) {
    if (element != null) {
      for (Iterator iter = element.attributeIterator(); iter.hasNext();) {
        Attribute attribute = (Attribute) iter.next();

        if (rawName.equals(attribute.getQualifiedName())) {
          return attribute.getValue();
        }
      }
    }

    return null;
View Full Code Here

  public String getAttributeValueFromName(String namespaceURI,
                                          String localName) {
    if (element != null) {
      for (Iterator iter = element.attributeIterator(); iter.hasNext();) {
        Attribute attribute = (Attribute) iter.next();

        if (namespaceURI.equals(attribute.getNamespaceURI())
            && localName.equals(attribute.getName())) {
          return attribute.getValue();
        }
      }
    }

    return null;
View Full Code Here

TOP

Related Classes of org.dom4j.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.