if (!(result instanceof SimpleXMLElementValue) && (name.toLong() == 0)) {
if (!(result instanceof StringValue) && !(result instanceof SimpleXMLElementValue) && (name.toLong() == 0)) {
  public Value get(Value name)  {    // If name is Long, then treat this as an array    // else treat as SimpleXMLElementValue    // if name = 0, then return th    // because $parent->child is equivalent to $parent->child[0]    if (name instanceof LongValue) {      Value result = super.get(name);      if (!(result instanceof SimpleXMLElementValue) && (name.toLong() == 0)) {        result = this;      }      return result;    } else {            // First check to see if there is an @attribute array      // If @attribute array exists and name is an attribute,      // then return the attribute value      Value attributeArray =  super.get(new StringValue("@attributes"));      if (attributeArray instanceof ArrayValue) {        Value value = attributeArray.get(name);        if (value instanceof StringValue)          return value;      }            // Either there is no @attribute array or name is not an attribute      // so assume we are meant to return a SimpleXMLElementValue      NodeList nodes = _element.getElementsByTagName(name.toString());      int nodeLength = nodes.getLength();      SimpleXMLElementValue result = new SimpleXMLElementValue(_element, _className, _options);            SimpleXMLElementValue childElement = null;            // if numberOfChildren = 1, then return childElement not result      // used because $parent->child is equivalent to $parent->child[0]      int numberOfChildren = 0;      for (int i = 0; i < nodeLength; i++) {        Node node = nodes.item(i);        if (node.getParentNode() == _element) {                    numberOfChildren++;          childElement = new SimpleXMLElementValue((Element) node, _className, _options);                    //Generate @attributes array, if applicable          NamedNodeMap attrs = node.getAttributes();          attributeArray = new ArrayValueImpl();          int attrLength = attrs.getLength();                    if (attrLength > 0) {            for (int j=0; j < attrLength; j++) {              Node attribute = attrs.item(j);              StringValue nodeName = new StringValue(attribute.getNodeName());              StringValue nodeValue = new StringValue(attribute.getNodeValue());              attributeArray.put(nodeName, nodeValue);            }            childElement.put(new StringValue("@attributes"), attributeArray, false);          }                    // Generate fillChildren array and store all          // values in result.  Also store attributes in result          // but use associative array (ie: simpleXmlElement['foo'] => bar)          if (node.getChildNodes().getLength() > 1)            result.put(fillChildren(childElement), false);          else {            childElement.put(new StringValue(node.getFirstChild().getNodeValue()), false);            result.put(childElement, false);          }        }      }            if (numberOfChildren == 1)        return childElement;      else        return result;    }  }