Package org.w3c.tidy

Examples of org.w3c.tidy.Tidy.parseDOM()


        tidy.setQuiet(true);
        tidy.setShowWarnings(false);
        org.w3c.dom.Document root = null;
        InputStream is = new FileInputStream(file);
        try {
          root =  tidy.parseDOM(is, null);
        } finally {
          is.close();
        }
        rawDoc = root.getDocumentElement();
    }
View Full Code Here


     */
    public HtmlDocument(InputStream is) {
        Tidy tidy = new Tidy();
        tidy.setQuiet(true);
        tidy.setShowWarnings(false);
        org.w3c.dom.Document root = tidy.parseDOM(is, null);
        rawDoc = root.getDocumentElement();
    }


    /**
 
View Full Code Here

        Tidy tidy = new Tidy();
        tidy.setConfigurationFromFile(tidyConfigFile);
        tidy.setQuiet(true);
        tidy.setShowWarnings(false);
        org.w3c.dom.Document root =
                tidy.parseDOM(new FileInputStream(file), null);
        rawDoc = root.getDocumentElement();
    }

    /**
     *  Creates a Lucene <code>Document</code> from a
View Full Code Here

                    logger.error("Error creating Tidy instance?!", t);
                }
                byte[] inputBytes = content.getBytes();
                ByteArrayInputStream inputStream =
                        new ByteArrayInputStream(inputBytes);
                responseDocument = tidy.parseDOM(inputStream, null); //use returned root node as only output
            }

            try {
                responseCookies2 = response.getAllHeaders();
                if (logger.isDebugEnabled()) {
View Full Code Here

                Tidy tidy = new Tidy();
                tidy.setQuiet(true);
                tidy.setXmlOut(true);
                tidy.setErrout(new PrintWriter(new ByteArrayOutputStream()));

                org.w3c.dom.Document dom = tidy.parseDOM(resource.getInputStream(), null);

                return new DOMReader().read(dom);
            } catch (Exception e) {
            }
        }
View Full Code Here

        Tidy tidy = new Tidy();
        ByteArrayOutputStream result = new ByteArrayOutputStream();
        tidy.setErrout(new PrintWriter(result));
        Document doc;
        try {
            doc = tidy.parseDOM(new BufferedInputStream(url.openStream()), new ByteArrayOutputStream());
        } catch (Throwable e) {
            if (errorOnDownloadFailure) {
                getLog().debug(new String(result.toByteArray()), e);
                throw new MojoExecutionException("Download or validation of '" + page + "' failed: " + e);
            } else {
View Full Code Here

        Tidy tidy = new Tidy();
        ByteArrayOutputStream result = new ByteArrayOutputStream();
        tidy.setErrout(new PrintWriter(result));
        Document doc;
        try {
            doc = tidy.parseDOM(new BufferedInputStream(url.openStream()), new ByteArrayOutputStream());
        } catch (Throwable e) {
            if (errorOnDownloadFailure) {
                getLog().debug(new String(result.toByteArray()), e);
                throw new MojoExecutionException("Download or validation of '" + page + "' failed: " + e);
            } else {
View Full Code Here

            StringWriter stringWriter = new StringWriter();
            //FIXME ??
            PrintWriter errorWriter = new PrintWriter(stringWriter);
            tidy.setErrout(errorWriter);
            // Extract the document using JTidy and stream it.
            Document doc = tidy.parseDOM(new BufferedInputStream(stream), null);
            errorWriter.flush();
            errorWriter.close();
            return doc;
        }
        catch (Exception ex) {
View Full Code Here

        Tidy tidy = createTidyParser();

        TidyErrorsListener errorListener = new TidyErrorsListener();
        tidy.setMessageListener(errorListener);

        Document document = tidy.parseDOM(inStream, null);

        if (errorListener.isBogus()) {
            throw new ConversionException("renderers.converter.safe.invalid");
        }
View Full Code Here

            // tidy.setQuiet(true);
            tidy.setNumEntities(true);
            tidy.setQuoteNbsp(true);
            tidy.setFixUri(false);

            Document document = tidy.parseDOM(new ByteArrayInputStream(content.getBytes()), null);
            StringWriter writer = new StringWriter();
            XmlUtils.serializePretty(document, writer);
            return writer.toString();
        } catch (Throwable e) {
            SoapUI.logError(e);
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.