XMLParserListener
public class XMLWorker extends java.lang.Object implements XMLParserListener
XMLParserListener
.WorkerContext
(Which is a WorkerContextImpl
) in a ThreadLocal
variable, WorkerContext is confined to threads here.Modifier and Type | Field | Description |
---|---|---|
protected boolean |
parseHtml |
|
protected Pipeline<?> |
rootpPipe |
Constructor | Description |
---|---|
XMLWorker(Pipeline<?> pipeline,
boolean parseHtml) |
Constructs a new XMLWorker
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Triggered when parsing is finished and the stream will be closed.
|
protected static void |
closeLocalWC() |
|
void |
comment(java.lang.String comment) |
Triggered for comments that are found.
|
protected Tag |
createTag(java.lang.String tag,
java.util.Map<java.lang.String,java.lang.String> attr,
java.lang.String ns) |
Creates a new Tag object from the given parameters.
|
void |
endElement(java.lang.String tag,
java.lang.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(java.lang.String tag,
java.util.Map<java.lang.String,java.lang.String> attr,
java.lang.String ns) |
Triggered on an opening tag.
|
void |
text(java.lang.String text) |
This method passes encountered text to the pipeline via the
Pipeline.content(WorkerContext, Tag, String, ProcessObject)
method. |
void |
unknownText(java.lang.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()
XMLParserListener
init
in interface XMLParserListener
public void startElement(java.lang.String tag, java.util.Map<java.lang.String,java.lang.String> attr, java.lang.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(java.lang.String tag, java.util.Map<java.lang.String,java.lang.String> attr, java.lang.String ns)
tag
- the tag nameattr
- the attributesns
- the namespace if anypublic void endElement(java.lang.String tag, java.lang.String ns)
XMLParserListener
endElement
in interface XMLParserListener
tag
- the tagns
- the namespace or empty Stringpublic void text(java.lang.String text)
Pipeline.content(WorkerContext, Tag, String, ProcessObject)
method.text
in interface XMLParserListener
text
- the textpublic void unknownText(java.lang.String text)
XMLParserListener
unknownText
in interface XMLParserListener
text
- the textpublic void comment(java.lang.String comment)
XMLParserListener
comment
in interface XMLParserListener
comment
- the commentpublic void close()
XMLParserListener
close
in interface XMLParserListener
protected Tag getCurrentTag()
protected static WorkerContext getLocalWC()
close()
or closeLocalWC()
has been called before.protected static void closeLocalWC()
protected boolean ignoreCdata()
Copyright © 1998–2018. All rights reserved.