public static Comment [ ] toCommentArray ( Document doc , Object o ) throws PageException { // Node[] if ( o instanceof Node [ ] ) { Node [ ] nodes = ( Node [ ] ) o ; if ( _isAllOfSameType ( nodes , Node . COMMENT_NODE ) ) return ( Comment [ ] ) nodes ; Comment [ ] comments = new Comment [ nodes . length ] ; for ( int i = 0 ; i < nodes . length ; i ++ ) { comments [ i ] = toComment ( doc , nodes [ i ] ) ; } return comments ; } // Collection else if ( o instanceof Collection ) { Collection coll = ( Collection ) o ; Iterator < Object > it = coll . valueIterator ( ) ; List < Comment > comments = new ArrayList < Comment > ( ) ; while ( it . hasNext ( ) ) { comments . add ( toComment ( doc , it . next ( ) ) ) ; } return comments . toArray ( new Comment [ comments . size ( ) ] ) ; } // Node Map and List Node [ ] nodes = _toNodeArray ( doc , o ) ; if ( nodes != null ) return toCommentArray ( doc , nodes ) ; // Single Text Node try { return new Comment [ ] { toComment ( doc , o ) } ; } catch ( ExpressionException e ) { throw new XMLException ( "can't cast Object of type " + Caster . toClassName ( o ) + " to a XML Comment Array" ) ; } }
casts a value to a XML Comment Array