code: public static Node[] toNodeArray(Document doc, Object o) throws PageException {
  	if (o instanceof Node) return new Node[] { (Node) o };
  	// Node[]
  	if (o instanceof Node[]) {
  	    return (Node[]) o;
  	}
  	// Collection
  	else if (o instanceof Collection) {
  	    Collection coll = (Collection) o;
  	    Iterator<Object> it = coll.valueIterator();
  	    List<Node> nodes = new ArrayList<Node>();
  	    while (it.hasNext()) {
  		nodes.add(toNode(doc, it.next(), false));
  	    }
  	    return nodes.toArray(new Node[nodes.size()]);
  	}
  	// Node Map and List
  	Node[] nodes = _toNodeArray(doc, o);
  	if (nodes != null) return nodes;
  	// Single Text Node
  	try {
  	    return new Node[] { toNode(doc, o, false) };
  	}
  	catch (ExpressionException e) {
  	    throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Node Array");
  	}
      }
docs: casts a value to a XML Element Array
  
  @param doc XML Document
  @param o Object to cast
  @return XML Comment Array
  @throws PageException