_children.put(new LongValue(0), new StringValue(children.item(0).getNodeValue()));
_children.put(new LongValue(0), simpleXMLChild);
  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>();    /**     * All child text nodes get ignored ifthere are more children     *      * For example:     *      * $foo = simplexml_load_string('<foo>before<fooChild>misc</fooChild>after</foo>');     * print_r($foo) =>     *  SimpleXMLElement Object     *  (     *    [fooChild] => misc     *  )     *      * print_r($foo->children()) =>      *  SimpleXMLElement Object     *  (     *     [0] => misc     *  )     *      * COMPARE WITH:     *      * $foo = simplexml_load_string('<foo>bar</foo>');     * print_r($foo) =>     *  SimpleXMLElement Object     *  (     *    [0] => bar     *  )     *      * print_r($foo->children()) =>     *  SimpleXMLElement Object     *  (     *  )     * Therefore, treat the case of 1 child as special case     */    if (nodeLength == 1) { //("#text".equals(children.item(0).getNodeName()))) {      Node firstChild = children.item(0);      _children = new ArrayValueImpl();      if (firstChild.getNodeType() == Node.TEXT_NODE)        _children.put(new LongValue(0), new StringValue(children.item(0).getNodeValue()));      else        _children.put(new StringValue(firstChild.getNodeName()), new SimpleXMLElementClass(_document, (Element) firstChild));    } else {      for (int i=0; i < nodeLength; i++) {        Node child = children.item(i);        //skip all text nodes since we know that there is more than 1 node        if (child.getNodeType() == Node.TEXT_NODE) //(child.getNodeName().equals("#text"))          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);        }        childArray.put(new SimpleXMLElementClass(_document, (Element) child));      }    }    //loop through childrenList and put each element in _children    if (childrenList.size() > 0) {      _children = new ArrayValueImpl();      for (StringValue childName : childrenList) {        ArrayValue childArray = childrenHashMap.get(childName);        if (childArray.getSize() == 1)          _children.put(childName,childArray.get(new LongValue(0)));        else          _children.put(childName, childArray);      }    } else if (_children == null) { //_children wasn't set in case of exactly 1 child      _children = NullValue.NULL;    }  }