Package org.cyberneko.html.filters

Examples of org.cyberneko.html.filters.Writer


         * remove all elements and script parts
         */
        ElementRemover remover = new ElementRemover();
        remover.removeElement(REMOVE_SCRIPT);
        StringWriter contentWriter = new StringWriter();
        Writer writer = new Writer(contentWriter, CHAR_ENCODING);
        XMLDocumentFilter[] filters = { remover, writer, };
        XMLParserConfiguration parser = new HTMLConfiguration();
        parser.setProperty("http://cyberneko.org/html/properties/filters",
                filters);
        XMLInputSource source = new XMLInputSource(null, null, null,
View Full Code Here


    /** Main. */
    public static void main(String[] argv) throws Exception {
        HTMLConfiguration parser = new HTMLConfiguration();
        parser.setFeature(AUGMENTATIONS, true);
        XMLDocumentFilter[] filters = { new Script(parser), new Identity(), new Writer() };
        parser.setProperty(FILTERS, filters);
        for (int i = 0; i < argv.length; i++) {
            parser.parse(new XMLInputSource(null, argv[i], null));
        }
    } // main(String[])
View Full Code Here

    /** Main. */
    public static void main(String[] argv) throws Exception {
        HTMLConfiguration parser = new HTMLConfiguration();
        parser.setFeature(AUGMENTATIONS, true);
        XMLDocumentFilter[] filters = { new Script(parser), new Identity(), new Writer() };
        parser.setProperty(FILTERS, filters);
        for (int i = 0; i < argv.length; i++) {
            parser.parse(new XMLInputSource(null, argv[i], null));
        }
    } // main(String[])
View Full Code Here

    /** Main. */
    public static void main(String[] argv) throws Exception {
        HTMLConfiguration parser = new HTMLConfiguration();
        parser.setFeature(AUGMENTATIONS, true);
        XMLDocumentFilter[] filters = { new Script(parser), new Identity(), new Writer() };
        parser.setProperty(FILTERS, filters);
        for (int i = 0; i < argv.length; i++) {
            parser.parse(new XMLInputSource(null, argv[i], null));
        }
    } // main(String[])
View Full Code Here

            InputSource is = new InputSource(new StringReader(str));
            is.setEncoding(fileEncoding);

            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
           
            XMLDocumentFilter[] filters = { new Writer(baos, fileEncoding) {
             
                protected void printStartElement(QName element, XMLAttributes attributes) {
                    fPrinter.print('<');
                    fPrinter.print(element.rawname);
                    int attrCount = attributes != null ? attributes.getLength() : 0;
View Full Code Here

    /** Main. */
    public static void main(String[] argv) throws Exception {
        HTMLConfiguration parser = new HTMLConfiguration();
        parser.setFeature(AUGMENTATIONS, true);
        XMLDocumentFilter[] filters = { new Script(parser), new Identity(), new Writer() };
        parser.setProperty(FILTERS, filters);
        for (int i = 0; i < argv.length; i++) {
            parser.parse(new XMLInputSource(null, argv[i], null));
        }
    } // main(String[])
View Full Code Here

    public String stripTags(String sourceText) {
        if (sourceText == null || sourceText.equals("")) {
            return "";
        }
        StringWriter sw = new StringWriter();
        Writer writer = new Writer(sw, null);
        XMLDocumentFilter[] filters = {
                remover, writer,
        };
        XMLParserConfiguration parser = new HTMLConfiguration();
        parser.setProperty("http://cyberneko.org/html/properties/filters", filters);
View Full Code Here

TOP

Related Classes of org.cyberneko.html.filters.Writer

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.