Examples of Tidy


Examples of org.w3c.tidy.Tidy

     * @param text the string to be tidied
     */
    private void normalize(String text) throws ProcessingException {
        try {
            // Setup an instance of Tidy.
            Tidy tidy = new Tidy();
            tidy.setXmlOut(true);

            if (this.properties == null) {
                tidy.setXHTML(true);
            } else {
                tidy.setConfigurationFromProps(this.properties);
            }

            //Set Jtidy warnings on-off
            tidy.setShowWarnings(getLogger().isWarnEnabled());
            //Set Jtidy final result summary on-off
            tidy.setQuiet(!getLogger().isInfoEnabled());
            //Set Jtidy infos to a String (will be logged) instead of System.out
            StringWriter stringWriter = new StringWriter();
            PrintWriter errorWriter = new PrintWriter(stringWriter);
            tidy.setErrout(errorWriter);

            // Extract the document using JTidy and stream it.
            ByteArrayInputStream bais =
                new ByteArrayInputStream(text.getBytes());
            org.w3c.dom.Document doc =
                tidy.parseDOM(new BufferedInputStream(bais), null);

            // FIXME: Jtidy doesn't warn or strip duplicate attributes in same
            // tag; stripping.
            XMLUtils.stripDuplicateAttributes(doc, null);

View Full Code Here

Examples of our.w3c.tidy.Tidy

     * XMLFilter to parse its input. This may need a default constructor later
     * with a setter for the filter.
     * @param filter The filter.
     */
    public HTMLResponseConditioner(XMLFilter filter) {
        tidy = new Tidy();
        tidy.setQuoteNbsp(true);
        tidy.setDocType("omit");
        tidy.setNumEntities(true);
        tidy.setShowWarnings(false);
        // iso latin 1 is the default HTTP/HTML encoding
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.