Java XML Attribute Get getAttributesValues(final StartElement element)

Here you can find the source of getAttributesValues(final StartElement element)

Description

get Attributes Values

License

Open Source License

Declaration

static Map<String, String> getAttributesValues(final StartElement element) 

Method Source Code

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

import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.StartElement;

import java.util.HashMap;

import java.util.Iterator;

import java.util.Map;

public class Main {
    static Map<String, String> getAttributesValues(final StartElement element) {
        final Map<String, String> values = new HashMap<>(4);

        @SuppressWarnings("unchecked")
        final Iterator<Attribute> attributes = element.getAttributes();
        while (attributes.hasNext()) {
            final Attribute attr = attributes.next();
            values.put(attr.getName().getLocalPart(), attr.getValue());
        }/* ww w . j  a v a  2 s.c  o  m*/

        return values;
    }
}

Related

  1. getAttributesCompact(NamedNodeMap attributes)
  2. getAttributesNamesOf(Element element)
  3. getAttributeString(Node node, String name)
  4. getAttributeStringValue(Node htmlForm, String attributeName, String defaultValue)
  5. getAttributeStringValue(String attribute, NamedNodeMap namedNodeMap)
  6. getAttributeTable(Element element)
  7. getAttributeText(final Node node, final String name)
  8. getAttributeTextContent(Node node, String attiribute_name)
  9. getAttributeUri(Element leaf, Element parent, String defaultBaseUri)