childArray.put(fillChildren((Element) child));
childArray.put(fillChildren(new SimpleXMLElementValue((Element) child, _className, _options)));
  public SimpleXMLElementValue fillChildren(Element node)  {    SimpleXMLElementValue childValue = new SimpleXMLElementValue((Element) node, _className, _options);        NodeList children = node.getChildNodes();        // Loop through children of node.    // If a child of node has no children itself, then it is empty    // and will be skipped.  If a child has only 1 child,    // then it is text, and the text will be added to childArray    // If a child has more than 1 child, then it is a parent node    // and will be added to childArray as a SimpleXMLElement.    HashMap<StringValue, ArrayValueImpl> childrenHashMap = new HashMap<StringValue, ArrayValueImpl>();        for (int j = 0; j < children.getLength(); j++) {      Node child = children.item(j);            //skip empty children      if (child.getChildNodes().getLength() == 0)        continue;            StringValue childName = new StringValue(child.getNodeName());            // Check to see if this is the first instance of a child      // with this NodeName.  If so create a new ArrayValueImpl,      // if not add to existing ArrayValueImpl      ArrayValueImpl childArray = childrenHashMap.get(childName);      if (childArray == null) {        childArray = new ArrayValueImpl();        childrenHashMap.put(childName, childArray);      }            //if text node return value      //otherwise recursive fill new SimpleXMLElement      if (child.getChildNodes().getLength() == 1)        childArray.put(new StringValue(child.getFirstChild().getNodeValue()));      else {        childArray.put(fillChildren((Element) child)); // recursion      }            // if childArray has only one element, only put the Value      // Note: if it turns out that a subsequent iteration adds      // to this particular childArray (ie: childArrayHashMap.get(childName)      // does not return null), then nodeArray.put() will replace      // whatever was stored in nodeArray.get(childName)      // with the updated childArray.      if (childArray.size() == 1)        childValue.put(childName,childArray.get(new LongValue(0)));      else        childValue.put(childName, childArray);    }        return childValue;  }