Java XML Attribute Get getAttributeNames(Element element)

Here you can find the source of getAttributeNames(Element element)

Description

get Attribute Names

License

Open Source License

Declaration

public static List<String> getAttributeNames(Element element) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.List;

import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;

public class Main {
    public static List<String> getAttributeNames(Element element) {
        List<String> names = new ArrayList<String>();
        NamedNodeMap list = element.getAttributes();
        for (int i = 0; i < list.getLength(); i++) {
            names.add(list.item(i).getNodeName());
        }//from  w ww  .j av  a 2  s  .  c  om
        return names;
    }
}

Related

  1. getAttributeMap(NamedNodeMap nodeMap)
  2. getAttributeMap(XMLEvent evt)
  3. getAttributeMap(XMLStreamReader xmlStreamReader)
  4. getAttributeName(Field field)
  5. getAttributeNames(Element el)
  6. getAttributeNames(final Element e)
  7. getAttributeNode(Node sNode, String attribName)
  8. getAttributeNode(Node sNode, String attribName)
  9. getAttributeNodeList(Element element, Pattern name)