All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.spun.util.ConfigXMLNodeExtractor Maven / Gradle / Ivy

There is a newer version: 24.9.0
Show newest version
package com.spun.util;

import com.spun.util.io.XMLNodeExtractor;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import java.util.ArrayList;
import java.util.HashMap;

public class ConfigXMLNodeExtractor implements XMLNodeExtractor
{
  public void extractProperty(Node node, HashMap properties)
  {
    //String name = node.getNodeName();
    if (XMLNodeExtractor.Utils.extractSingleton(node, properties))
    {
      // do nothing
    }
    else if (node.getChildNodes().getLength() > 0)
    {
      NodeList childNodes = node.getChildNodes();
      ArrayList v = new ArrayList();
      for (int i = 0; i < childNodes.getLength(); i++)
      {
        if (childNodes.item(i).getNodeName().equals("VALUE"))
        {
          v.add(StringUtils.loadNullableString(childNodes.item(i).getChildNodes().item(0).getNodeValue()));
        }
      }
      properties.put(node.getNodeName(), StringUtils.toArray(v));
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy