Package net.htmlparser.jericho

Examples of net.htmlparser.jericho.SourceFormatter$Processor


            result.setHtmlOutput(portletOutput);

            // what we need to do now is to do special processing for <script> tags, and on the client side we will
            // create them dynamically.
            Source source = new Source(portletOutput);
            source = new Source((new SourceFormatter(source)).toString());
            List<StartTag> scriptTags = source.getAllStartTags(HTMLElementName.SCRIPT);
            for (StartTag curScriptTag : scriptTags) {
                if ((curScriptTag.getAttributeValue("src") != null) &&
                        (!curScriptTag.getAttributeValue("src").equals(""))) {
                    result.getScriptsWithSrc().add(curScriptTag.getAttributeValue("src"));
View Full Code Here


            // replace /live/ by /default/ in href and src attributes as it represents same image
            if(original.contains("/files/"+Constants.EDIT_WORKSPACE+"/")||amendment.contains("/files/"+Constants.EDIT_WORKSPACE+"/")) {
                original = original.replaceAll("/"+ Constants.LIVE_WORKSPACE+"/","/"+Constants.EDIT_WORKSPACE+"/");
                amendment = amendment.replaceAll("/"+ Constants.LIVE_WORKSPACE+"/","/"+Constants.EDIT_WORKSPACE+"/");
            }
            original = new SourceFormatter(new Source(original)).toString();
            amendment = new SourceFormatter(new Source(amendment)).toString();
            final ContentHandler postProcess = filter.xsl(result, "jahiahtmlheader.xsl");

            final Locale locale = Locale.ENGLISH;
            final String prefix = "diff";
View Full Code Here

    public String execute(String previousOut, RenderContext renderContext, Resource resource, RenderChain chain)
            throws Exception {

        long timer = System.currentTimeMillis();
       
        final SourceFormatter sourceFormatter = new SourceFormatter(new Source(previousOut));
        sourceFormatter.setIndentString("  ");

        String out = sourceFormatter.toString();
       
        if (logger.isDebugEnabled()) {
          logger.debug("Formatting took {} ms", System.currentTimeMillis() - timer);
        }
       
View Full Code Here

    public static String getIndented(String inHTML) {
        String formated_html = null;
        try {
            StringWriter writer = new StringWriter();
            new SourceFormatter(new Source(inHTML)).setIndentString("    ").setTidyTags(true).setCollapseWhiteSpace(true).writeTo(writer);
            formated_html = writer.toString();
        }
        catch (IOException e) {
            LOG.log(Level.SEVERE, null, e);
        }
View Full Code Here

TOP

Related Classes of net.htmlparser.jericho.SourceFormatter$Processor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.