public class XMLWorker extends Object implements XMLParserListener
XMLParserListener.WorkerContext (Which is a WorkerContextImpl) in a ThreadLocal
variable, WorkerContext is confined to threads here.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
parseHtml |
protected Pipeline<?> |
rootpPipe |
| Constructor and Description |
|---|
XMLWorker(Pipeline<?> pipeline,
boolean parseHtml)
Constructs a new XMLWorker
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Triggered when parsing is finished and the stream will be closed.
|
protected static void |
closeLocalWC() |
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 static WorkerContext |
getLocalWC()
Returns the local WorkerContext, beware: could be a newly initialized
one, if
close() or closeLocalWC() has been called before. |
protected boolean |
ignoreCdata() |
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.
|
protected final Pipeline<?> rootpPipe
protected final boolean parseHtml
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.public void init()
XMLParserListenerinit in interface XMLParserListenerpublic void startElement(String tag, Map<String,String> attr, String ns)
XMLParserListenerstartElement in interface XMLParserListenertag - 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 anypublic void endElement(String tag, String ns)
XMLParserListenerendElement in interface XMLParserListenertag - the tagns - the namespace or empty Stringpublic void text(String text)
Pipeline.content(WorkerContext, Tag, String, ProcessObject)
method.text in interface XMLParserListenertext - the textpublic void unknownText(String text)
XMLParserListenerunknownText in interface XMLParserListenertext - the textpublic void comment(String comment)
XMLParserListenercomment in interface XMLParserListenercomment - the commentpublic void close()
XMLParserListenerclose in interface XMLParserListenerprotected Tag getCurrentTag()
protected static WorkerContext getLocalWC()
close() or closeLocalWC() has been called before.protected static void closeLocalWC()
protected boolean ignoreCdata()
Copyright © 2019. All rights reserved.