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

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

Description

attribute

License

Open Source License

Declaration

static String attribute(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 attribute(Node node, String... attributes) {
        String value = attributeOrNull(node, attributes);
        return value == null ? "" : value;
    }/*  www .  j  a  va  2 s  .c  o  m*/

    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();
        }
        return null;
    }
}

Related

  1. attr(Element element, String name)
  2. attr(Element element, String name)
  3. attrbiuteToMap( NamedNodeMap attributes)
  4. attribute(Element element, String attrName)
  5. attributeBooleanGet(Element e, String name, boolean defaultValue)
  6. attributeBooleanSet(Element base, String name, boolean value, boolean defaultValue)
  7. attributeBoolValue(Element e, String attr)
  8. attributeFloat(Node node, String attributeName)