com.opensymphony.xwork2.config.providers.XmlHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xwork Show documentation
Show all versions of xwork Show documentation
XWork is an command-pattern framework that is used to power WebWork
as well as other applications. XWork provides an Inversion of Control
container, a powerful expression language, data type conversion,
validation, and pluggable configuration.
/*
* Copyright (c) 2002-2006 by OpenSymphony
* All rights reserved.
*/
package com.opensymphony.xwork2.config.providers;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.Map;
import java.util.LinkedHashMap;
/**
* XML utilities.
*
* @author Mike
*/
public class XmlHelper {
public static Map getParams(Element paramsElement) {
LinkedHashMap params = new LinkedHashMap();
if (paramsElement == null) {
return params;
}
NodeList childNodes = paramsElement.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i);
if ((childNode.getNodeType() == Node.ELEMENT_NODE) && "param".equals(childNode.getNodeName())) {
Element paramElement = (Element) childNode;
String paramName = paramElement.getAttribute("name");
StringBuffer paramValue = new StringBuffer();
for (int j=0; j 0) {
params.put(paramName, val);
}
}
}
return params;
}
}