Java XML Attribute from Node getNodeMap(NamedNodeMap artifactAttributes)

Here you can find the source of getNodeMap(NamedNodeMap artifactAttributes)

Description

get Node Map

License

Open Source License

Declaration

static Map<String, String> getNodeMap(NamedNodeMap artifactAttributes) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005-2012 eBay Inc./*from w ww  .  ja v  a 2 s . co  m*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 *******************************************************************************/

import java.util.HashMap;

import java.util.Map;

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

public class Main {
    static Map<String, String> getNodeMap(NamedNodeMap artifactAttributes) {

        Map<String, String> attributeMap = new HashMap<String, String>();

        if (artifactAttributes != null) {
            int attributeCount = artifactAttributes.getLength();
            for (int idx = 0; idx < attributeCount; idx++) {
                Node attributeNode = artifactAttributes.item(idx);
                attributeMap.put(attributeNode.getNodeName(), attributeNode.getNodeValue());
            }
        }
        return attributeMap;
    }
}

Related

  1. getNodeAttributeValue(Node node, String attribute)
  2. getNodeAttributeValue(Node node, String attributeName)
  3. getNodeAttributeValue(Node node, String attributeName)
  4. getNodeAttributeValue(Node node, String attrName)
  5. getNodeAttributeValueNS(Node node, String namespaceURI, String attrName)
  6. getNodesByAttributeValue(Node node, String attrName, String attrValue)
  7. getNonEmptyAttribute(Element element, String namespace, String localName)
  8. getStringAttributeOptional(Node node, String attributeName, String valueIfEmpty)
  9. getStringAttributeRequired(Node node, String attributeName)