public void visitRemarkNode (Remark remarkNode) { modifiedResult.append (remarkNode.toHtml()); }
public void visitStringNode(Text stringNode) { modifiedResult.append (stringNode.toHtml()); }
for (Node node : theList.toNodeArray()) { System.out.println(node.toHtml()); }
/** * Convert this nodelist into the equivalent HTML. * @return The contents of the list as HTML text. */ public String toHtml() { StringBuilder buff = new StringBuilder(); for (int i=0;i<size;i++) buff.append(nodeData[i].toHtml()); return buff.toString(); }
/** * Convert this nodelist into the equivalent HTML. * @param verbatim If <code>true</code> return as close to the original * page text as possible. * @return The contents of the list as HTML text. */ public String toHtml (boolean verbatim) { StringBuffer ret; ret = new StringBuffer (); for (int i = 0; i < size; i++) ret.append (nodeData[i].toHtml (verbatim)); return (ret.toString ()); }
public void emit(ReplayParseContext context, Node node) throws IOException { OutputStream os = context.getOutputStream(); if(os != null) { os.write(startComment); os.write(node.toHtml(true).getBytes()); os.write(endComment); } }
public void emit(ReplayParseContext context, Node node) throws IOException { OutputStream os = context.getOutputStream(); if(os != null) { os.write(startComment); os.write(node.toHtml(true).getBytes()); os.write(endComment); } }
public void visitEndTag(Tag tag) { Node parent; parent = tag.getParent (); // process only those nodes not processed by a parent if (null == parent) // an orphan end tag modifiedResult.append(tag.toHtml()); else if (null == parent.getParent ()) // a top level tag with no parents modifiedResult.append(parent.toHtml()); }
public void emit(ReplayParseContext context, Node node) throws ServletException, IOException { OutputStream os = context.getOutputStream(); if(os != null) { String charset = context.getOutputCharset(); String rawHTML = node.toHtml(true); try { os.write(rawHTML.getBytes(charset)); } catch (UnsupportedEncodingException e) { e.printStackTrace(); os.write(rawHTML.getBytes()); } } }
public String toHtml(HtmlTable startTable, HtmlTable endBeforeTable) { int index = 0; if (startTable != null) { index = nodes.indexOf(startTable.getTableNode()); } Node endTag = null; if (endBeforeTable != null) { endTag = endBeforeTable.getTableNode(); } StringBuilder html = new StringBuilder(512); for (int i = index; i < nodes.size() && nodes.get(i) != endTag; i++) { Node node = nodes.get(i); html.append(node.toHtml()); } return html.toString(); }
public void emit(ReplayParseContext context, Node node) throws ServletException, IOException { OutputStream os = context.getOutputStream(); if(os != null) { String charset = context.getOutputCharset(); String rawHTML = node.toHtml(true); try { os.write(rawHTML.getBytes(charset)); } catch (UnsupportedEncodingException e) { e.printStackTrace(); os.write(rawHTML.getBytes()); } } }
protected void emit(ReplayParseContext context, String pre, Node node, String post) throws IOException { OutputStream out = context.getOutputStream(); if (out != null) { // Charset charset = Charset.forName(context.getOutputCharset()); String charset = context.getOutputCharset(); if (pre != null) { out.write(pre.getBytes(charset)); } if (node != null) { out.write(node.toHtml(true).getBytes(charset)); } if (post != null) { out.write(post.getBytes(charset)); } } }
public void visitEndTag(Tag tag) { Node parent; parent = tag.getParent (); // process only those nodes not processed by a parent if (null == parent) // an orphan end tag modifiedResult.append(tag.toHtml()); else if (null == parent.getParent ()) // a top level tag with no parents modifiedResult.append(parent.toHtml()); }
/** * Add the textual contents of the end tag of this node to the buffer. * @param verbatim If <code>true</code> return as close to the original * page text as possible. * @param sb The buffer to append to. */ protected void putEndTagInto (StringBuffer sb, boolean verbatim) { // eliminate virtual tags if (!verbatim || !(mEndTag.getStartPosition () == mEndTag.getEndPosition ())) sb.append (getEndTag ().toHtml()); }
/** * Add the textual contents of the children of this node to the buffer. * @param sb The buffer to append to. */ protected void putChildrenInto(StringBuilder sb) { Node node; for (SimpleNodeIterator e = children (); e.hasMoreNodes ();) { node = e.nextNode (); // eliminate virtual tags // if (!(node.getStartPosition () == node.getEndPosition ())) sb.append (node.toHtml ()); } }
@Override public void handleNode(ParseContext context, Node node) throws IOException { String html = node.toHtml(); //System.out.print(html); ((ReplayParseContext) context).getOutputStream().write( html.getBytes("UTF-8")); } @Override
private String getValueOfTagWithAttributeValue(String attribute, String value) throws Exception { NodeList matches = getMatchingTags(new HasAttributeFilter(attribute, value)); if (matches.size() != 1) return String.format("There are %d matches, there should be 1.", matches.size()); else return matches.elementAt(0).toHtml(); }
private String getValueOfTagWithAttributeValue(String attribute, String value) throws Exception { NodeList matches = getMatchingTags(new HasAttributeFilter(attribute, value)); if (matches.size() != 1) return String.format("There are %d matches, there should be 1.", matches.size()); else return matches.elementAt(0).toHtml(); }
/** * Add the textual contents of the children of this node to the buffer. * @param verbatim If <code>true</code> return as close to the original * page text as possible. * @param sb The buffer to append to. */ protected void putChildrenInto (StringBuffer sb, boolean verbatim) { Node node; for (SimpleNodeIterator e = children (); e.hasMoreNodes ();) { node = e.nextNode (); // eliminate virtual tags if (!verbatim || !(node.getStartPosition () == node.getEndPosition ())) sb.append (node.toHtml ()); } }
public void visitTag(Tag tag) { if (tag instanceof LinkTag) ((LinkTag)tag).setLink(linkPrefix + ((LinkTag)tag).getLink()); else if (tag instanceof ImageTag) ((ImageTag)tag).setImageURL(linkPrefix + ((ImageTag)tag).getImageURL()); // process only those nodes that won't be processed by an end tag, // nodes without parents or parents without an end tag, since // the complete processing of all children should happen before // we turn this node back into html text if (null == tag.getParent () && (!(tag instanceof CompositeTag) || null == ((CompositeTag)tag).getEndTag ())) modifiedResult.append(tag.toHtml()); }