Examples of Tidy


Examples of com.dotcms.repackage.org.w3c.tidy.Tidy

      String s = sw.toString();
      s = escapeEspecialCharacter(s);

      s = processCSSPath(s, host, "css", "\\(", "\\)", ")", url);
      s = processCSSPath(s, host, "css", "\\\"", "\\\"", "\"", url);
      Tidy tidy = new Tidy();
      tidy.setXHTML(true);

      ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      tidy.parse(is, os);
      s = os.toString();

      is = new ByteArrayInputStream(s.getBytes());
      Document doc = builder.parse(is);
View Full Code Here

Examples of org.ajax4jsf.org.w3c.tidy.Tidy

  /**
   *
   */
  public TidyParser(Properties props) {
    tidy = new Tidy();
    tidy.setConfigurationFromProps(props);
    // tidy.setConfigurationFromProps(getProperties("tidy.properties"));
    PrintWriter errout = new PrintWriter(new ErrorWriter());
    tidy.setErrout(errout);
    tidy.setForceOutput(true);
View Full Code Here

Examples of org.ajax4jsf.org.w3c.tidy.Tidy

  /**
   *
   */
  public TidyParser(Properties props) {
    tidy = new Tidy();
    tidy.setConfigurationFromProps(props);
    // tidy.setConfigurationFromProps(getProperties("tidy.properties"));
    PrintWriter errout = new PrintWriter(new ErrorWriter());
    tidy.setErrout(errout);
    tidy.setForceOutput(true);
View Full Code Here

Examples of org.w3c.tidy.Tidy

   */
  private void parseToDOM() {
    ByteArrayInputStream is = new ByteArrayInputStream(content);
   
    // set tidy parameters
    Tidy tidy = new Tidy();
    tidy.setUpperCaseTags(false);
    tidy.setUpperCaseAttrs(false);
    tidy.setErrout(new PrintWriter(System.err));
   
    domDoc = tidy.parseDOM(is,null);
  }
View Full Code Here

Examples of org.w3c.tidy.Tidy

      return input;
    }

    // okay, parse the HTML code
    ByteArrayInputStream bis = new ByteArrayInputStream(input.getContent());
    Tidy tidy = new Tidy();
    tidy.setUpperCaseTags(false);
    tidy.setUpperCaseAttrs(false);
    tidy.setErrout(new PrintWriter(new NullWriter()));

    Document doc = tidy.parseDOM(bis,null);

    rewriteDOM(doc,input.getURL());

    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    tidy.pprint(doc,bos);

    input.setContent(bos.toByteArray());
   
    return input;
  }
View Full Code Here

Examples of org.w3c.tidy.Tidy

  public ByteArrayOutputStream transformHTML(String sHTML)
    throws IOException,FOPException,TransformerException,TransformerConfigurationException {
    ByteArrayOutputStream oXml = new ByteArrayOutputStream();
    StringBufferInputStream oHtm = new StringBufferInputStream(sHTML);
    Tidy oTdy = new Tidy();
    oTdy.setXmlOut(true);
    oTdy.setTidyMark(false);
    oTdy.setNumEntities(true);
  oTdy.parseDOM(oHtm, oXml);
  return transformXHTML(oXml.toString(Charset.defaultCharset().name()));
  }
View Full Code Here

Examples of org.w3c.tidy.Tidy

      throw new NullPointerException("Input HTML code string is NULL");
    }
    StringReader stringReader = new StringReader(htmlCode);
    StringWriter tidyHtmlWriter = new StringWriter();
    try{
      Tidy tidy = new Tidy();
      tidy.setPrintBodyOnly(bodyOnly);
      tidy.setJoinClasses(true);
      tidy.setJoinStyles(true);
      tidy.setQuoteAmpersand(true);
      tidy.setHideComments(true);
      tidy.setInputEncoding(encoding);
      tidy.setOutputEncoding(encoding);   
      tidy.parse(stringReader,tidyHtmlWriter);
      return tidyHtmlWriter.getBuffer().toString();
    }catch(Exception e){
      logger.error("FormatUtil: tidyHTML error: " + e);
    }finally{   
      if(stringReader != null){
View Full Code Here

Examples of org.w3c.tidy.Tidy

        }
        return false;
    }
   
    public InputStream tidy(InputStream is) {
        Tidy tidy = new Tidy();
        tidy.setXHTML(false);
        tidy.setPrintBodyOnly(true);
        tidy.setDocType("loose");
        tidy.setXHTML(true);
        tidy.setForceOutput(true);
        java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream(1024);
        tidy.parse(is,out);
        return new ByteArrayInputStream(out.toByteArray());
    }
View Full Code Here

Examples of org.w3c.tidy.Tidy

    }
    public void testPageRender() throws IOException {
        HtmlCanvas html = new HtmlCanvas();
        html.render(new PersonalPage());
       
        Tidy tidy = new Tidy();
        tidy.setMessageListener(new TidyMessageCheck());
        tidy.setXHTML(true);
        tidy.setDocType("loose");
        tidy.parse(new ByteArrayInputStream(html.toHtml().getBytes()), System.out);       
    }
View Full Code Here

Examples of org.w3c.tidy.Tidy

    public void testPageRenderWithError() throws IOException {
        HtmlCanvas html = new HtmlCanvas();
        html.tag("bogus");
        html.render(new PersonalPage());
       
        Tidy tidy = new Tidy();
        tidy.setMessageListener(new TidyMessageCheck());
        tidy.setXHTML(true);
        tidy.setDocType("loose");
        try {
            tidy.parse(new ByteArrayInputStream(html.toHtml().getBytes()), System.out);       
        } catch (AssertionFailedError err) {
            System.out.println(err);
            // good thing
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.