if (node.getNodeName().equals("variable")) {
NodeList children = node.getChildNodes();
// create Variable Object
String variableName = ((Element) node).getAttribute("name");
Variable variable = new Variable(variableName);
// loop through to fill Variable
String type = null, value = null;
for (int j = 0; j < children.getLength(); j++) {
Node child = children.item(j);
// get the Variable's name
if (child.getNodeName().equals("type")) {
type = XMLUtils.getSimpleElementText((Element) child,
true).toLowerCase();
// get the Variable's value
} else if (child.getNodeName().equals("value")) {
value = PathUtils.doDynamicReplacement(XMLUtils
.getSimpleElementText((Element) child, false));
// get the Variable's value's precision infomation
} else if (child.getNodeName().equals("precision")) {
NodeList grandChildren = child.getChildNodes();
for (int k = 0; k < grandChildren.getLength(); k++) {
Node grandChild = grandChildren.item(k);
// get the precision
if (grandChild.getNodeName().equals("locations")) {
variable.setPrecision(Integer.parseInt(XMLUtils
.getSimpleElementText((Element) grandChild, true)));
// get the fill character to meet the precision
// [optional]
} else if (grandChild.getNodeName().equals("fill")) {
variable.setFillString(
XMLUtils.getSimpleElementText((Element) grandChild, false));
// get the side for which the fill character
// will be applied [optional]
} else if (grandChild.getNodeName().equals("side")) {
variable.setFillSide(
(XMLUtils.getSimpleElementText((Element) grandChild, true)
.toLowerCase().equals("front"))
? variable.FILL_FRONT
: variable.FILL_BACK);
}
}
}
}
// determine if variable is an Integer or a String
if (type.equals("int")) {
variable.setValue(new Integer(value));
} else
variable.setValue(value);
// store Variable in list of Variables
GlobalVariables.hashMap.put(variable.getName(), variable);
}
}
}