Here you can find the source of parseProperties(Node doc)
Parameter | Description |
---|---|
n | the XML node |
@Deprecated public static Map<String, String> parseProperties(Node doc)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /**//from w ww . j a va 2 s. c o m * Parse the childnodes of a node and look for <property> elements with attributes name and value. * Example: * <node> * <property name='n' value='v'/> * <node/> * @param n the XML node * @return the parsed properties * @deprecated Use XMLHelper.parseProperties( Node doc ) instead */ @Deprecated public static Map<String, String> parseProperties(Node doc) { NodeList propertyNodes = doc.getChildNodes(); Map<String, String> properties = new HashMap<String, String>(); for (int i = 0; i < propertyNodes.getLength(); i++) { Node node = propertyNodes.item(i); if (node.getNodeName().equals("property")) { String key = node.getAttributes().getNamedItem("name").getNodeValue(); String value = node.getAttributes().getNamedItem("value").getNodeValue(); properties.put(key, value); } } return properties; } }