Package nl.siegmann.epublib.bookprocessor

Examples of nl.siegmann.epublib.bookprocessor.HtmlCleanerBookProcessor.processHtml()


    String expectedResult = Constants.DOCTYPE_XHTML + "\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>title</title></head><body>Hello, world!</body></html>";
    try {
      Resource resource = new Resource(testInput.getBytes(Constants.CHARACTER_ENCODING), "test.html");
      book.getResources().add(resource);
      HtmlCleanerBookProcessor htmlCleanerBookProcessor = new HtmlCleanerBookProcessor();
      byte[] processedHtml = htmlCleanerBookProcessor.processHtml(resource, book, Constants.CHARACTER_ENCODING);
      String actualResult = new String(processedHtml, Constants.CHARACTER_ENCODING);
      assertEquals(expectedResult, actualResult);
    } catch (IOException e) {
      assertTrue(e.getMessage(), false);
    }
View Full Code Here


    String testInput = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>test page</title><link foo=\"bar\" /></head><body background=\"red\">Hello, world!</body></html>";
    try {
      Resource resource = new Resource(testInput.getBytes(Constants.CHARACTER_ENCODING), "test.html");
      book.getResources().add(resource);
      HtmlCleanerBookProcessor htmlCleanerBookProcessor = new HtmlCleanerBookProcessor();
      byte[] processedHtml = htmlCleanerBookProcessor.processHtml(resource, book, Constants.CHARACTER_ENCODING);
      String result = new String(processedHtml, Constants.CHARACTER_ENCODING);
      assertEquals(Constants.DOCTYPE_XHTML + "\n" + testInput, result);
    } catch (IOException e) {
      assertTrue(e.getMessage(), false);
    }
View Full Code Here

    String testInput = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>test page</title></head><body>Hello, world! ß</body></html>";
    try {
      Resource resource = new Resource(null, testInput.getBytes(Constants.CHARACTER_ENCODING), "test.html", MediatypeService.XHTML, Constants.CHARACTER_ENCODING);
      book.getResources().add(resource);
      HtmlCleanerBookProcessor htmlCleanerBookProcessor = new HtmlCleanerBookProcessor();
      byte[] processedHtml = htmlCleanerBookProcessor.processHtml(resource, book, Constants.CHARACTER_ENCODING);
      String result = new String(processedHtml, Constants.CHARACTER_ENCODING);
      assertEquals(Constants.DOCTYPE_XHTML + "\n" + testInput, result);
    } catch (IOException e) {
      assertTrue(e.getMessage(), false);
    }
View Full Code Here

    String expectedResult = Constants.DOCTYPE_XHTML + "\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>title</title></head><body>Hello, world!\nHow are you ?</body></html>";
    try {
      Resource resource = new Resource(testInput.getBytes(Constants.CHARACTER_ENCODING), "test.html");
      book.getResources().add(resource);
      HtmlCleanerBookProcessor htmlCleanerBookProcessor = new HtmlCleanerBookProcessor();
      byte[] processedHtml = htmlCleanerBookProcessor.processHtml(resource, book, Constants.CHARACTER_ENCODING);
      String actualResult = new String(processedHtml, Constants.CHARACTER_ENCODING);
      assertEquals(expectedResult, actualResult);
    } catch (IOException e) {
      assertTrue(e.getMessage(), false);
    }
View Full Code Here

    String expectedResult = Constants.DOCTYPE_XHTML + "\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>title</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + Constants.CHARACTER_ENCODING + "\" /></head><body>Hello, world!</body></html>";
    try {
      Resource resource = new Resource(testInput.getBytes(Constants.CHARACTER_ENCODING), "test.html");
      book.getResources().add(resource);
      HtmlCleanerBookProcessor htmlCleanerBookProcessor = new HtmlCleanerBookProcessor();
      byte[] processedHtml = htmlCleanerBookProcessor.processHtml(resource, book, Constants.CHARACTER_ENCODING);
      String actualResult = new String(processedHtml, Constants.CHARACTER_ENCODING);
      assertEquals(expectedResult, actualResult);
    } catch (IOException e) {
      assertTrue(e.getMessage(), false);
    }
View Full Code Here

    String expectedResult = Constants.DOCTYPE_XHTML + "\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>title</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + Constants.CHARACTER_ENCODING + "\" /></head><body>Hello, world!</body></html>";
    try {
      Resource resource = new Resource(testInput.getBytes(Constants.CHARACTER_ENCODING), "test.html");
      book.getResources().add(resource);
      HtmlCleanerBookProcessor htmlCleanerBookProcessor = new HtmlCleanerBookProcessor();
      byte[] processedHtml = htmlCleanerBookProcessor.processHtml(resource, book, Constants.CHARACTER_ENCODING);
      String actualResult = new String(processedHtml, Constants.CHARACTER_ENCODING);
      assertEquals(expectedResult, actualResult);
    } catch (IOException e) {
      assertTrue(e.getMessage(), false);
    }
View Full Code Here

    String expectedResult = Constants.DOCTYPE_XHTML + "\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>title</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=" + Constants.CHARACTER_ENCODING + "\" /></head><body>Hello, world!</body></html>";
    try {
      Resource resource = new Resource(testInput.getBytes(Constants.CHARACTER_ENCODING), "test.html");
      book.getResources().add(resource);
      HtmlCleanerBookProcessor htmlCleanerBookProcessor = new HtmlCleanerBookProcessor();
      byte[] processedHtml = htmlCleanerBookProcessor.processHtml(resource, book, Constants.CHARACTER_ENCODING);
      String actualResult = new String(processedHtml, Constants.CHARACTER_ENCODING);
      assertEquals(expectedResult, actualResult);
    } catch (IOException e) {
      assertTrue(e.getMessage(), false);
    }
View Full Code Here

    String expectedResult = Constants.DOCTYPE_XHTML + "\n<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>title</title></head><body>Hello, world!</body></html>";
    try {
      Resource resource = new Resource(testInput.getBytes(Constants.CHARACTER_ENCODING), "test.html");
      book.getResources().add(resource);
      HtmlCleanerBookProcessor htmlCleanerBookProcessor = new HtmlCleanerBookProcessor();
      byte[] processedHtml = htmlCleanerBookProcessor.processHtml(resource, book, Constants.CHARACTER_ENCODING);
      String actualResult = new String(processedHtml, Constants.CHARACTER_ENCODING);
      assertEquals(expectedResult, actualResult);
    } catch (IOException e) {
      assertTrue(e.getMessage(), false);
    }
View Full Code Here

    String testInput = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>test page</title></head><body>'hi'</body></html>";
    try {
      Resource resource = new Resource(null, testInput.getBytes(Constants.CHARACTER_ENCODING), "test.html", MediatypeService.XHTML, Constants.CHARACTER_ENCODING);
      book.getResources().add(resource);
      HtmlCleanerBookProcessor htmlCleanerBookProcessor = new HtmlCleanerBookProcessor();
      byte[] processedHtml = htmlCleanerBookProcessor.processHtml(resource, book, Constants.CHARACTER_ENCODING);
      String result = new String(processedHtml, Constants.CHARACTER_ENCODING);
      assertEquals(Constants.DOCTYPE_XHTML + "\n" + testInput, result);
    } catch (IOException e) {
      assertTrue(e.getMessage(), false);
    }
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.