|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.itextpdf.tool.xml.XMLWorker
public class XMLWorker
The implementation of the XMLParserListener
.
Important Note: This class the XMLWorker stores the
WorkerContext
(Which is a WorkerContextImpl
) in a ThreadLocal
variable, WorkerContext is confined to threads here.
Constructor Summary | |
---|---|
XMLWorker(Pipeline<?> pipeline,
boolean parseHtml)
Constructs a new XMLWorker |
Method Summary | |
---|---|
void |
close()
Triggered when parsing is finished and the stream will be closed. |
void |
comment(String comment)
Triggered for comments that are found. |
protected Tag |
createTag(String tag,
Map<String,String> attr,
String ns)
Creates a new Tag object from the given parameters. |
void |
endElement(String tag,
String ns)
Triggered on a closing tag. |
protected Tag |
getCurrentTag()
Returns the current tag. |
protected WorkerContext |
getLocalWC()
Returns the local WorkerContext, beware: could be a newly initialized one, if close() has been called before. |
void |
init()
Triggered when parsing has started. |
void |
startElement(String tag,
Map<String,String> attr,
String ns)
Triggered on an opening tag. |
void |
text(String text)
This method passes encountered text to the pipeline via the Pipeline.content(WorkerContext, Tag, String, ProcessObject)
method. |
void |
unknownText(String text)
Triggered for text found outside root tag. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLWorker(Pipeline<?> pipeline, boolean parseHtml)
pipeline
- the pipelineparseHtml
- true if this XMLWorker is parsing HTML, this actually
just means: convert all tags to lowercase.Method Detail |
---|
public void init()
XMLParserListener
init
in interface XMLParserListener
public void startElement(String tag, Map<String,String> attr, String ns)
XMLParserListener
startElement
in interface XMLParserListener
tag
- the tag of the elementattr
- the attributes found on the tagns
- the namespace or empty Stringprotected Tag createTag(String tag, Map<String,String> attr, String ns)
tag
- the tag nameattr
- the attributesns
- the namespace if any
public void endElement(String tag, String ns)
XMLParserListener
endElement
in interface XMLParserListener
tag
- the tagns
- the namespace or empty Stringpublic void text(String text)
Pipeline.content(WorkerContext, Tag, String, ProcessObject)
method.
text
in interface XMLParserListener
text
- the textpublic void unknownText(String text)
XMLParserListener
unknownText
in interface XMLParserListener
text
- the textpublic void comment(String comment)
XMLParserListener
comment
in interface XMLParserListener
comment
- the commentpublic void close()
XMLParserListener
close
in interface XMLParserListener
protected Tag getCurrentTag()
protected WorkerContext getLocalWC()
close()
has been called before.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |