Java XML Attribute from Node xmlGetAttribute2(Node node, String attrname)

Here you can find the source of xmlGetAttribute2(Node node, String attrname)

Description

xml Get Attribute

License

Apache License

Declaration

public static void xmlGetAttribute2(Node node, String attrname) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class Main {
    public static void xmlGetAttribute2(Node node, String attrname) {
        NamedNodeMap attrs = node.getAttributes();
        if (attrs != null) {
            for (int i = 0; i < attrs.getLength(); i++) {
                Node attr = attrs.item(i);
                /*/*from   ww  w . ja  v a2s. c o m*/
                System.out.println("attr.getNodeName() = " + attr.getNodeName());
                System.out.println("attr.getLocalName() = " + attr.getLocalName());
                System.out.println("attr.getNodeValue() = " + attr.getNodeValue());
                */
            }
        }
    }
}

Related

  1. parseAttribute(NodeList abtList)
  2. parseAttributes(Node n)
  3. parseAttributes(Node node)
  4. parseAttributesTag(Node n)
  5. xmlGetAttribute(Node node, String attrname)