Java XML Attribute Get getAttributeValues(Element el)

Here you can find the source of getAttributeValues(Element el)

Description

Gets a list of all attribute values for the given DOM element.

License

Open Source License

Declaration

public static String[] getAttributeValues(Element el) 

Method Source Code

//package com.java2s;

import org.w3c.dom.*;

public class Main {
    /** Gets a list of all attribute values for the given DOM element. */
    public static String[] getAttributeValues(Element el) {
        NamedNodeMap map = el.getAttributes();
        int len = map.getLength();
        String[] attrValues = new String[len];
        for (int i = 0; i < len; i++) {
            Attr attr = (Attr) map.item(i);
            attrValues[i] = attr == null ? null : attr.getValue();
        }/*  w w w .  j a va 2 s  .  c  om*/
        return attrValues;
    }
}

Related

  1. getAttributeValueIgnoreCase(Element element, String attributeName)
  2. getAttributeValueNS(@Nonnull final Element aElement, @Nullable final String sNamespaceURI, @Nonnull final String sAttrName, @Nullable final String sDefault)
  3. getAttributeValueNS(Element element, String namespace, String attrName)
  4. getAttributeValueOrNull(NamedNodeMap attributes, String attributeName)
  5. getAttributeValuePair(Node node)
  6. getAttributeValues(Node node, String nodeName, String attrName)
  7. getAttributeWithInheritance(Element element, String attributeName)
  8. getAttributName(Node node)
  9. getAttributValue(Node n, String name)