public class NamespaceCountingCallbackHandler extends Object implements NamespaceCallbackHandler
NamespaceCallbackHandler implementation that counts every occurrence of any element in any namespace.
Add an instance to any number of PodcastParser instances. Generate a report using
toString().
This implementation is threadsafe.
| Constructor and Description |
|---|
NamespaceCountingCallbackHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
beforeProcess(String rootNamespace,
Feed feed,
XMLStreamReader reader)
Receives a callback before
Namespace.process(PodcastParserContext) is invoked. |
void |
beforeProcess(String rootNamespace,
Item item,
XMLStreamReader reader)
Receives a callback before
Namespace.process(PodcastParserContext, Item) is invoked. |
ElementCounter |
getCounter() |
void |
registerUnknownNamespace(String rootNamespace,
XMLStreamReader reader,
ParseLevel level)
Receives a callback when an element is encountered for which no handling has been defined in this
library.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitregisterUnhandledElementpublic void beforeProcess(String rootNamespace, Feed feed, XMLStreamReader reader)
NamespaceCallbackHandler
Receives a callback before Namespace.process(PodcastParserContext) is invoked.
Note that any implementation must not move the reader. Doing so will cause an
IllegalStateException to be thrown.
beforeProcess in interface NamespaceCallbackHandlerrootNamespace - String name of the root namespace (RSS|Atom)feed - Feed instance in the process of being builtreader - XMLStreamReader instance, having just processed a
XMLStreamConstants.START_ELEMENT event with this namespace.public void beforeProcess(String rootNamespace, Item item, XMLStreamReader reader)
NamespaceCallbackHandler
Receives a callback before Namespace.process(PodcastParserContext, Item) is invoked.
Note that any implementation must not move the reader. Doing so will cause an
IllegalStateException to be thrown.
beforeProcess in interface NamespaceCallbackHandlerrootNamespace - String name of the root namespace (RSS|Atom)item - Item instance in the process of being builtreader - XMLStreamReader instance, having just processed a
XMLStreamConstants.START_ELEMENT event with this namespace.public void registerUnknownNamespace(String rootNamespace, XMLStreamReader reader, ParseLevel level)
NamespaceCallbackHandlerReceives a callback when an element is encountered for which no handling has been defined in this library.
Note that any implementation must not move the reader. Doing so will cause an
IllegalStateException to be thrown.
registerUnknownNamespace in interface NamespaceCallbackHandlerrootNamespace - String name of the root namespace (RSS|Atom)reader - XMLStreamReader instance, having just processed a
XMLStreamConstants.START_ELEMENT event with the given namespace.level - ParseLevel level at which the element is encounteredpublic ElementCounter getCounter()
Copyright © 2018. All rights reserved.