Java XML Attribute Set attributeOrNull(Node node, String... attributes)

Here you can find the source of attributeOrNull(Node node, String... attributes)

Description

attribute Or Null

License

Open Source License

Declaration

static String attributeOrNull(Node node, String... attributes) 

Method Source Code

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

import org.w3c.dom.Node;

public class Main {
    static String attributeOrNull(Node node, String... attributes) {
        for (int i = 0; i < attributes.length; i++) {
            String attribute = attributes[i];
            Node attr = node.getAttributes().getNamedItem(attribute);
            if (attr != null)
                return attr.getNodeValue();
        }/*from  w w w.j  ava 2 s .  c  o  m*/
        return null;
    }
}

Related

  1. attributeBooleanSet(Element base, String name, boolean value, boolean defaultValue)
  2. attributeBoolValue(Element e, String attr)
  3. attributeFloat(Node node, String attributeName)
  4. attributeIntValue(Element e, String attr)
  5. attributeMap(Element element)
  6. attributeOrValue(Element element, String mainAttribute, String... alternateAttributes)
  7. attributes(final Element element)
  8. attributesAsMap(Element element)
  9. attributesOf(Element element)