Examples of HTMLSerializer


Examples of net.sf.jpluck.plucker.parsing.html.HTMLSerializer

public class TextRecordResult extends SAXResult {
    private HTMLSerializer serializer;

    public TextRecordResult(TextRecord textRecord, URIRewriter uriRewriter, int textColorBrightness, boolean parseTables,
    Document document) {
        serializer = new HTMLSerializer(textRecord, uriRewriter, textColorBrightness, parseTables, document);
        setHandler(serializer);
       
    }
View Full Code Here

Examples of net.sf.jpluck.plucker.parsing.html.HTMLSerializer

        for (int i = 0, n = items.length; i < n; i++) {
          String uri = resource.getURI() + "_item-" + (i + 1);
          TextRecord textRecord = new TextRecord(uri,
                               jxlDocument.getOutputEncoding(),
                               jxlDocument.isUseHiresMargins());
          HTMLSerializer serializer = new HTMLSerializer(textRecord, jxlDocument.getURIRewriter(),
                                   settings.getTextColorBrightness(), settings.isParseTables(),
                                   pluckerDocument);
          Transformer transformer = TransformerFactory.newInstance().newTransformer();
          transformer.transform(new DOMSource(formatter.getItemDocuments()[i]), new SAXResult(serializer));
          pluckerDocument.addRecord(serializer.getDataRecord());
         
          String[] pageURIs = serializer.getLinkURIs();
          for (int j = 0; j < pageURIs.length; j++) {
            if (!pageURIs[j].startsWith(resource.getURI() + "_item-")) {
              addPageLink(pageURIs[j]);
            }
          }

          String[] imageURIs = serializer.getEmbeddedImageURIs();
          for (int j = 0; j < imageURIs.length; j++) {
            addImageLink(imageURIs[j]);
          }

          if (generateBookmarks) {
View Full Code Here

Examples of nu.validator.htmlparser.sax.HtmlSerializer

            htmlParser.setBogusXmlnsPolicy(XmlViolationPolicy.ALTER_INFOSET);
            htmlParser.setMappingLangToXmlLang(true);
            htmlParser.setReportingDoctype(false);
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            Writer w = new OutputStreamWriter(out, "UTF-8");
            HtmlSerializer ser = new VoidElementFixHtmlSerializer(w);
            htmlParser.setContentHandler(ser);
            htmlParser.setLexicalHandler(ser);
            if (!fragment)
                htmlParser.parse(new InputSource(in));
            else
View Full Code Here

Examples of nu.validator.htmlparser.sax.HtmlSerializer

            if (outputDest == null) {
                //???
                xqeval.setDestination(serializer);
            } else if (outputDest instanceof OutputStream) {
                ch = new HtmlSerializer((OutputStream) outputDest);
                xqeval.setDestination(new SAXDestination(ch));
            } else if (outputDest instanceof Writer) {
                ch = new HtmlSerializer((Writer) outputDest);
                xqeval.setDestination(new SAXDestination(ch));
            } else if (outputDest instanceof File) {
                try {
                    FileOutputStream fos = new FileOutputStream((File) outputDest);
                    ch = new HtmlSerializer(fos);
                    xqeval.setDestination(new SAXDestination(ch));
                } catch (FileNotFoundException fnfe) {
                    xqeval.setDestination(serializer);
                }
            } else {
View Full Code Here

Examples of nu.validator.htmlparser.sax.HtmlSerializer

        try {
            if (outputFormat == OutputFormat.HTML
                    || outputFormat == OutputFormat.XHTML) {
                if (outputFormat == OutputFormat.HTML) {
                    response.setContentType("text/html; charset=utf-8");
                    contentHandler = new HtmlSerializer(out);
                } else {
                    response.setContentType("application/xhtml+xml");
                    contentHandler =
                            new XmlSerializer(out);
                }
View Full Code Here

Examples of nu.validator.htmlparser.sax.HtmlSerializer

        try {
            if (outputFormat == OutputFormat.HTML
                    || outputFormat == OutputFormat.XHTML) {
                if (outputFormat == OutputFormat.HTML) {
                    response.setContentType("text/html; charset=utf-8");
                    contentHandler = new HtmlSerializer(out);
                } else {
                    response.setContentType("application/xhtml+xml");
                    contentHandler =
                            new XmlSerializer(out);
                }
View Full Code Here

Examples of nu.validator.htmlparser.sax.HtmlSerializer

      htmlParser.setBogusXmlnsPolicy(XmlViolationPolicy.ALTER_INFOSET);    
      htmlParser.setMappingLangToXmlLang(true);
      htmlParser.setReportingDoctype(false);         
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Writer w = new OutputStreamWriter(out, "UTF-8");
      HtmlSerializer ser = new VoidElementFixHtmlSerializer(w);
      htmlParser.setContentHandler(ser);
      htmlParser.setLexicalHandler(ser);
      if (!fragment)
        htmlParser.parse(new InputSource(in));
      else
View Full Code Here

Examples of nu.validator.htmlparser.sax.HtmlSerializer

                System.arraycopy(counters, 0, countersCopy, 0, counters.length);
            }
            double totalDouble = (double) totalCopy;
            double uptimeMillis = (double) (System.currentTimeMillis() - startTime);
            response.setContentType("text/html; charset=utf-8");
            ContentHandler ch = new HtmlSerializer(response.getOutputStream());
            try {
                ch.startDocument();
                startElement(ch, "html");
                startElement(ch, "head");
                startElement(ch, "title");
                characters(ch, VALIDATOR_STATISTICS);
                endElement(ch, "title");
                endElement(ch, "head");
                startElement(ch, "body");
                startElement(ch, "h1");
                characters(ch, VALIDATOR_STATISTICS);
                endElement(ch, "h1");

                startElement(ch, "dl");
                startElement(ch, "dt");
                characters(ch, TOTAL_VALIDATIONS);
                endElement(ch, "dt");
                startElement(ch, "dd");
                characters(ch, totalCopy);
                endElement(ch, "dd");

                startElement(ch, "dt");
                characters(ch, UPTIME_DAYS);
                endElement(ch, "dt");
                startElement(ch, "dd");
                characters(ch, uptimeMillis / (1000 * 60 * 60 * 24));
                endElement(ch, "dd");

                startElement(ch, "dt");
                characters(ch, VALIDATIONS_PER_SECOND);
                endElement(ch, "dt");
                startElement(ch, "dd");
                characters(ch, totalDouble / (uptimeMillis / 1000.0));
                endElement(ch, "dd");

                endElement(ch, "dl");

                startElement(ch, "table");
                startElement(ch, "thead");
                startElement(ch, "tr");
                startElement(ch, "th");
                characters(ch, COUNTER_NAME);
                endElement(ch, "th");
                startElement(ch, "th");
                characters(ch, COUNTER_VALUE);
                endElement(ch, "th");
                startElement(ch, "th");
                characters(ch, COUNTER_PROPORTION);
                endElement(ch, "th");
                endElement(ch, "tr");
                endElement(ch, "thead");
                startElement(ch, "tbody");
                for (int i = 0; i < countersCopy.length; i++) {
                    long count = countersCopy[i];
                    startElement(ch, "tr");
                    startElement(ch, "td");

                    characters(ch, Field.values()[i].toString());

                    endElement(ch, "td");
                    startElement(ch, "td");

                    characters(ch, count);

                    endElement(ch, "td");
                    startElement(ch, "td");

                    characters(ch, ((double) count) / totalDouble);

                    endElement(ch, "td");
                    endElement(ch, "tr");
                }
                endElement(ch, "tbody");
                endElement(ch, "table");
                endElement(ch, "body");
                endElement(ch, "html");
            } finally {
                ch.endDocument();
            }
        } catch (SAXException e) {
            throw new IOException(e);
        }
    }
View Full Code Here

Examples of nu.validator.htmlparser.sax.HtmlSerializer

        try {
            if (outputFormat == OutputFormat.HTML
                    || outputFormat == OutputFormat.XHTML) {
                if (outputFormat == OutputFormat.HTML) {
                    response.setContentType("text/html; charset=utf-8");
                    contentHandler = new HtmlSerializer(out);
                } else {
                    response.setContentType("application/xhtml+xml");
                    contentHandler =
                            new XmlSerializer(out);
                }
View Full Code Here

Examples of org.apache.garbage.serializer.HTMLSerializer

                          + resource + "\" in application context.");
            return;
        }

        /* Start building up the serializer */
        HTMLSerializer serializer = new HTMLSerializer();
        ServletOutputStream out = res.getOutputStream();
        serializer.setOutput(out, this.charset);

        String content = serializer.getContentType();
        res.setContentType(serializer.getContentType());


        out.println("<HTML><BODY>&quot;" + url + "&quot;</BODY></HTML>");

        out.flush();
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.