@Override public boolean accept(Node node) { return content.matcher(node.getText()).find(); } }
public boolean accept(Node node) { return (pattern.matcher(node.getText()).matches()); } }
@Override public boolean accept(Node node) { return content.matcher(node.getText().toLowerCase()).find(); } }
public String find(final Pattern pattern, int n) { for (final Node tag : filter(Tag.class, new ContainsFilter(pattern))) { final Matcher matcher = pattern.matcher(tag.getText()); if (matcher.find()) return matcher.group(n); } return null; }
private void exception(final String filePath, final Node node, final Exception e) { String lineNumbers = ""; String element = ("" + node).toLowerCase(); if (node instanceof TagNode) { lineNumbers = ":" + lineNumbering(node); element = "tag <" + node.getText() + ">"; } throw new ScimpiException("Error processing " + element + " in " + filePath + lineNumbers, e); }
/** * 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 ); }
private void parseNode(List<AbstractContainer> nodes, int current, List<Item> items) { AbstractContainer node = nodes.get(current); final String content = node.getDataAsString(); final Lexer lexer = new Lexer(content); Node cursor = null; try { while ((cursor = lexer.nextNode()) != null) { if (cursor instanceof Remark) { items.add(new SimpleComment(cursor.getText())); } else if (cursor instanceof Text) { items.add(new SimpleText(cursor.toHtml())); } else if (cursor instanceof org.htmlparser.Tag) { processTag(nodes, current, items, (org.htmlparser.Tag) cursor); } else { throw new BrixException("Unknown node type " + cursor.getClass().getName()); } } } catch (ParserException e) { throw new BrixException("Couldn't parse node content: '" + node.getPath() + "'", e); } }
buf.append("<!--").append(node.getText()).append("-->");
String count = "0"; if (childs.size() == 6) { count = childs.elementAt(5).getFirstChild().getFirstChild().getLastChild().getText();
System.out.println(content.getText()); content.setParent (tag);