Package org.htmlcleaner

Examples of org.htmlcleaner.SimpleXmlSerializer


        return CommonUtil.toHTML(xml);
      }else if (node instanceof TagNode){
        StringWriter sw = new StringWriter();
        //TODO 从配置文件里加载这个CleanerProperties
        CleanerProperties prop = new HtmlCleaner().getProperties();
        SimpleXmlSerializer ser = new SimpleXmlSerializer(prop);
        ser.write((TagNode)node, sw, "UTF-8");
          String html = sw.getBuffer().toString();
          if (keepHeader)
            xml = html;
          else
            xml = html.substring(html.indexOf("?>")+2);
View Full Code Here


    // Write the resource content to disk. This step is needed, as the preview
    // generator can only handle files.
    try {
      xhtmlFile = File.createTempFile("xhtml", ".xml");
      Serializer xhtmlSerializer = new SimpleXmlSerializer(xhtmlProperties);
      xhtmlSerializer.writeToFile(xhtmlNode, xhtmlFile.getAbsolutePath(), "UTF-8");
    } catch (IOException e) {
      logger.error("Error creating temporary copy of file content at " + xhtmlFile, e);
      FileUtils.deleteQuietly(xhtmlFile);
      throw e;
    } finally {
View Full Code Here

TOP

Related Classes of org.htmlcleaner.SimpleXmlSerializer

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.