public class XMLWorkerHelper extends Object
Modifier and Type | Method and Description |
---|---|
static CssFile |
getCSS(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(String html,
String css)
Parses an HTML string and a string containing CSS into a list of Element objects.
|
void |
parseXHtml(ElementHandler d,
InputStream in,
Charset charset) |
void |
parseXHtml(ElementHandler d,
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. |
void |
parseXHtml(PdfWriter writer,
Document doc,
InputStream in) |
void |
parseXHtml(PdfWriter writer,
Document doc,
InputStream in,
Charset charset) |
void |
parseXHtml(PdfWriter writer,
Document doc,
InputStream in,
Charset charset,
FontProvider fontProvider) |
void |
parseXHtml(PdfWriter writer,
Document doc,
InputStream in,
InputStream inCssFile) |
void |
parseXHtml(PdfWriter writer,
Document doc,
InputStream in,
InputStream inCssFile,
Charset charset) |
void |
parseXHtml(PdfWriter writer,
Document doc,
InputStream in,
InputStream inCssFile,
Charset charset,
FontProvider fontProvider) |
void |
parseXHtml(PdfWriter writer,
Document doc,
InputStream in,
InputStream inCssFile,
Charset charset,
FontProvider fontProvider,
String resourcesRootPath) |
void |
parseXHtml(PdfWriter writer,
Document doc,
InputStream in,
InputStream inCssFile,
FontProvider fontProvider) |
void |
parseXHtml(PdfWriter writer,
Document doc,
Reader in)
Parses the xml data.
|
public static XMLWorkerHelper getInstance()
public static CssFile getCSS(InputStream in)
public CssFile getDefaultCSS()
public void parseXHtml(ElementHandler d, Reader in) throws IOException
Element
s to the defined ElementHandler.d
- the handlerin
- the readerIOException
- thrown when something went wrong with the IOpublic void parseXHtml(PdfWriter writer, Document doc, Reader in) throws IOException
writer
- the PdfWriterdoc
- the Documentin
- the readerIOException
- thrown when something went wrong with the IOpublic void parseXHtml(PdfWriter writer, Document doc, InputStream in) throws IOException
writer
- the writer to usedoc
- the document to usein
- the InputStream
of the XHTML source.IOException
- if the InputStream
could not be read.public void parseXHtml(PdfWriter writer, Document doc, InputStream in, Charset charset, FontProvider fontProvider) throws IOException
IOException
public void parseXHtml(PdfWriter writer, Document doc, InputStream in, Charset charset) throws IOException
writer
- the writer to usedoc
- the document to usein
- the InputStream
of the XHTML source.charset
- the charset to useIOException
- if the InputStream
could not be read.public void parseXHtml(PdfWriter writer, Document doc, InputStream in, InputStream inCssFile, Charset charset, FontProvider fontProvider) throws 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 useIOException
- if the InputStream
could not be read.public void parseXHtml(PdfWriter writer, Document doc, InputStream in, InputStream inCssFile, Charset charset, FontProvider fontProvider, String resourcesRootPath) throws 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)IOException
- if the InputStream
could not be read.public void parseXHtml(PdfWriter writer, Document doc, InputStream in, InputStream inCssFile) throws IOException
IOException
public void parseXHtml(PdfWriter writer, Document doc, InputStream in, InputStream inCssFile, FontProvider fontProvider) throws IOException
IOException
public void parseXHtml(PdfWriter writer, Document doc, InputStream in, InputStream inCssFile, Charset charset) throws IOException
IOException
public void parseXHtml(ElementHandler d, InputStream in, Charset charset) throws IOException
d
- the ElementHandlerin
- the InputStreamcharset
- the charset to useIOException
- 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(String html, String css) throws IOException
html
- a String containing an XHTML snippetcss
- a String containing CSSIOException
Copyright © 2017. All rights reserved.