if ((child.getChildNodes().getLength() == 1) && (child.getFirstChild().getNodeName().equals("#text"))) childArray.put(new StringValue(child.getFirstChild().getNodeValue())); else childArray.put(new SimpleXMLElementClass((Element) child));
  private void fillChildren()  {    NodeList children = _element.getChildNodes();    int nodeLength = children.getLength();    HashMap<StringValue, ArrayValue> childrenHashMap = new HashMap<StringValue, ArrayValue>();    ArrayList<StringValue> childrenList = new ArrayList<StringValue>();        for (int i=0; i < nodeLength; i++) {      Node child = children.item(i);            //skip empty children (ie: "\n ")      if ((child.getNodeName().equals("#text")) && (child.getChildNodes().getLength() == 0))        continue;            StringValue childTagName = 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      ArrayValue childArray = childrenHashMap.get(childTagName);      if (childArray == null) {        childArray = new ArrayValueImpl();        childrenHashMap.put(childTagName, childArray);        childrenList.add(childTagName);      }            // if only text, put StringValue       if ((child.getChildNodes().getLength() == 1) && (child.getFirstChild().getNodeName().equals("#text")))        childArray.put(new StringValue(child.getFirstChild().getNodeValue()));      else        childArray.put(new SimpleXMLElementClass((Element) child));    }        //loop through childrenHashMap and put each element in this SimpleXMLElement    if (childrenList.size() > 0) {      for (StringValue childName : childrenList) {        ArrayValue childArray = childrenHashMap.get(childName);        _children = new ArrayValueImpl();        if (childArray.getSize() == 1)          _children.put(childName,childArray.get(new LongValue(0)));        else          _children.put(childName, childArray);      }    } else {      _children = NullValue.NULL;    }  }