public Node[] getTags() { return tags.toNodeArray(); } }
public Node[] getTags() { return tags.toNodeArray(); } }
public Node [] getTags(int index) { return tags[index].toNodeArray(); }
public Node [] getTags(int index) { return tags[index].toNodeArray(); }
/** * Get the children as an array of <code>Node</code> objects. * @return The children in an array. */ public Node [] getChildrenAsNodeArray () { return ( (null == getChildren ()) ? new Node[0] : getChildren ().toNodeArray ()); }
/** * Get the children as an array of <code>Node</code> objects. * @return The children in an array. */ public Node [] getChildrenAsNodeArray () { return ( (null == getChildren ()) ? new Node[0] : getChildren ().toNodeArray ()); }
/** * Retrieves the value of a table cell. Appends the text of child nodes of * the cell. In case of composite tags like span or div the inner text is * appended. */ public static String getValue( TagNode cell ) { StringBuilder builder = new StringBuilder(); for ( Node child : cell.getChildren().toNodeArray() ) { if ( child instanceof CompositeTag ) { builder.append( ((CompositeTag) child).getStringText() ); } else { builder.append( child.getText() ); } } return builder.toString().trim().replaceAll( " ", EMPTY ); }
/** * Convenience method to extract all nodes of a given class type. * Equivalent to * <code>extractAllNodesThatMatch (new NodeClassFilter (nodeType))</code>. * @param nodeType The class of the nodes to collect. * @throws ParserException If a parse error occurs. * @return A list of nodes which have the class specified. * @deprecated Use extractAllNodesThatMatch (new NodeClassFilter (cls)). * @see #extractAllNodesThatAre */ public Node [] extractAllNodesThatAre (Class nodeType) throws ParserException { NodeList ret; ret = extractAllNodesThatMatch (new NodeClassFilter (nodeType)); return (ret.toNodeArray ()); }
/** * Search given node and pick up any objects of given type. * @param node The node to search. * @param type The class to search for. * @return A node array with the matching nodes. */ public static Node[] findTypeInNode(Node node, Class type) { NodeFilter filter; NodeList ret; ret = new NodeList (); filter = new NodeClassFilter (type); node.collectInto (ret, filter); return (ret.toNodeArray ()); }
/** * Search given node and pick up any objects of given type. * @param node The node to search. * @param type The class to search for. * @return A node array with the matching nodes. */ public static Node[] findTypeInNode(Node node, Class type) { NodeFilter filter; NodeList ret; ret = new NodeList (); filter = new NodeClassFilter (type); node.collectInto (ret, filter); return (ret.toNodeArray ()); }
/** * Returns the number of columns/cells in the given row, including cell spacing. */ private static int getColumnCount( TableRow row ) { Node[] cells = row.getChildren().extractAllNodesThatMatch( HTML_ROW_FILTER ).toNodeArray(); int cols = 0; for ( Node cell : cells ) { Integer colSpan = MathUtils.parseInt( ((TagNode) cell).getAttribute( "colspan" ) ); cols += colSpan != null ? colSpan : 1; } return cols; }
Node[] tables = parser.extractAllNodesThatMatch( new TagNameFilter( "table" ) ).toNodeArray(); Node[] cells = row.getChildren().extractAllNodesThatMatch( HTML_ROW_FILTER ).toNodeArray();