public class XMLWorkerHelper
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
static CssFile |
getCSS(java.io.InputStream in) |
|
CssFile |
getDefaultCSS() |
|
CSSResolver |
getDefaultCssResolver(boolean addDefaultCss) |
Get a CSSResolver implementation.
|
protected TagProcessorFactory |
getDefaultTagProcessorFactory() |
Retrieves the default factory for processing HTML tags from
Tags.getHtmlTagProcessorFactory() . |
static XMLWorkerHelper |
getInstance() |
Get a Singleton XMLWorkerHelper
|
static ElementList |
parseToElementList(java.lang.String html,
java.lang.String css) |
Parses an HTML string and a string containing CSS into a list of Element objects.
|
void |
parseXHtml(PdfWriter writer,
Document doc,
java.io.InputStream in) |
|
void |
parseXHtml(PdfWriter writer,
Document doc,
java.io.InputStream in,
java.io.InputStream inCssFile) |
|
void |
parseXHtml(PdfWriter writer,
Document doc,
java.io.InputStream in,
java.io.InputStream inCssFile,
FontProvider fontProvider) |
|
void |
parseXHtml(PdfWriter writer,
Document doc,
java.io.InputStream in,
java.io.InputStream inCssFile,
java.nio.charset.Charset charset) |
|
void |
parseXHtml(PdfWriter writer,
Document doc,
java.io.InputStream in,
java.io.InputStream inCssFile,
java.nio.charset.Charset charset,
FontProvider fontProvider) |
|
void |
parseXHtml(PdfWriter writer,
Document doc,
java.io.InputStream in,
java.io.InputStream inCssFile,
java.nio.charset.Charset charset,
FontProvider fontProvider,
java.lang.String resourcesRootPath) |
|
void |
parseXHtml(PdfWriter writer,
Document doc,
java.io.InputStream in,
java.nio.charset.Charset charset) |
|
void |
parseXHtml(PdfWriter writer,
Document doc,
java.io.InputStream in,
java.nio.charset.Charset charset,
FontProvider fontProvider) |
|
void |
parseXHtml(PdfWriter writer,
Document doc,
java.io.Reader in) |
Parses the xml data.
|
void |
parseXHtml(ElementHandler d,
java.io.InputStream in,
java.nio.charset.Charset charset) |
|
void |
parseXHtml(ElementHandler d,
java.io.Reader in) |
Parses the xml data in the given reader and sends created
Element
s to the defined ElementHandler.This method configures the XMLWorker and XMLParser to parse (X)HTML/CSS and accept unknown tags. |
public static XMLWorkerHelper getInstance()
public static CssFile getCSS(java.io.InputStream in)
public CssFile getDefaultCSS()
public void parseXHtml(ElementHandler d, java.io.Reader in) throws java.io.IOException
Element
s to the defined ElementHandler.d
- the handlerin
- the readerjava.io.IOException
- thrown when something went wrong with the IOpublic void parseXHtml(PdfWriter writer, Document doc, java.io.Reader in) throws java.io.IOException
writer
- the PdfWriterdoc
- the Documentin
- the readerjava.io.IOException
- thrown when something went wrong with the IOpublic void parseXHtml(PdfWriter writer, Document doc, java.io.InputStream in) throws java.io.IOException
writer
- the writer to usedoc
- the document to usein
- the InputStream
of the XHTML source.java.io.IOException
- if the InputStream
could not be read.public void parseXHtml(PdfWriter writer, Document doc, java.io.InputStream in, java.nio.charset.Charset charset, FontProvider fontProvider) throws java.io.IOException
java.io.IOException
public void parseXHtml(PdfWriter writer, Document doc, java.io.InputStream in, java.nio.charset.Charset charset) throws java.io.IOException
writer
- the writer to usedoc
- the document to usein
- the InputStream
of the XHTML source.charset
- the charset to usejava.io.IOException
- if the InputStream
could not be read.public void parseXHtml(PdfWriter writer, Document doc, java.io.InputStream in, java.io.InputStream inCssFile, java.nio.charset.Charset charset, FontProvider fontProvider) throws java.io.IOException
writer
- the writer to usedoc
- the document to usein
- the InputStream
of the XHTML source.in
- the CssFiles
of the css files.charset
- the charset to usejava.io.IOException
- if the InputStream
could not be read.public void parseXHtml(PdfWriter writer, Document doc, java.io.InputStream in, java.io.InputStream inCssFile, java.nio.charset.Charset charset, FontProvider fontProvider, java.lang.String resourcesRootPath) throws java.io.IOException
writer
- the writer to usedoc
- the document to usein
- the InputStream
of the XHTML source.in
- the CssFiles
of the css files.charset
- the charset to useresourcesRootPath
- defines the root path to find resources in case they are defined in html with relative paths (e.g. images)java.io.IOException
- if the InputStream
could not be read.public void parseXHtml(PdfWriter writer, Document doc, java.io.InputStream in, java.io.InputStream inCssFile) throws java.io.IOException
java.io.IOException
public void parseXHtml(PdfWriter writer, Document doc, java.io.InputStream in, java.io.InputStream inCssFile, FontProvider fontProvider) throws java.io.IOException
java.io.IOException
public void parseXHtml(PdfWriter writer, Document doc, java.io.InputStream in, java.io.InputStream inCssFile, java.nio.charset.Charset charset) throws java.io.IOException
java.io.IOException
public void parseXHtml(ElementHandler d, java.io.InputStream in, java.nio.charset.Charset charset) throws java.io.IOException
d
- the ElementHandlerin
- the InputStreamcharset
- the charset to usejava.io.IOException
- if something went seriously wrong with IO.public CSSResolver getDefaultCssResolver(boolean addDefaultCss)
addDefaultCss
- true if the defaultCss should already be added.protected TagProcessorFactory getDefaultTagProcessorFactory()
Tags.getHtmlTagProcessorFactory()
. On subsequent calls the same
TagProcessorFactory
is returned every time. DefaultTagProcessorFactory that maps HTML tags to TagProcessor
s
public static ElementList parseToElementList(java.lang.String html, java.lang.String css) throws java.io.IOException
html
- a String containing an XHTML snippetcss
- a String containing CSSjava.io.IOException
Copyright © 1998–2018. All rights reserved.