|
GXPARSE hosted by | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ca.gorman.xml.parse.util.PackageNamespaceElementMapper<T>
public class PackageNamespaceElementMapper<T extends Parser>
Will be deprecated or removed Maps each XML namespaces to a Java package and maps XML elements in the namespace to element handlers in the package.
Each namespace is specified by a
NamespaceEntry
that
has the namespace identifier, the corresponding Java package, and
information on how to map the names of each element in the namespace to the
class name of corresponding element handler
. Each
element handler class must have a public constructor that takes no
parameters.
Warning
PackageNamespaceElementMapper
uses Java reflection to identify
and load element handlers at runtime. Generic type parameters cannot be
checked at run time. A returned handler can be an
ElementListener
that is is not an
ElementListener<T>
, leading to runtime exceptions from
handler.
Nested Class Summary | |
---|---|
static class |
PackageNamespaceElementMapper.DuplicateNamespaceException
Exception thrown when attempting to load a namespace entry
having the same namespace identifier as a previously loaded entry. |
static class |
PackageNamespaceElementMapper.NamespaceEntry<T extends Parser>
Associates an XML namespace with a Java package and the information needed to map element names in that namespace to element handler classes in the package. |
Nested classes/interfaces inherited from interface ca.gorman.xml.parse.ElementMapper |
---|
ElementMapper.InvalidHandlerException, ElementMapper.NotFoundException |
Field Summary |
---|
Fields inherited from interface ca.gorman.xml.parse.ElementMapper |
---|
ESCAPE_CENT, ESCAPE_CURRENCY, ESCAPE_DOLLAR, ESCAPE_POUND, ESCAPE_YEN |
Constructor Summary | |
---|---|
PackageNamespaceElementMapper(ElementListener<T> defaultElementHandler,
PackageNamespaceElementMapper.NamespaceEntry<T>[] namespaceEntry)
Construct an element mapper to invoke element handlers in the Java package that corresponds to the element namespace, specifying a default element handler for elements outside any of the namespaces. |
Method Summary | |
---|---|
void |
doElement(T parser,
CurrentElement element)
Receive a request to handle a element that is
being parsed, and invoke the appropriate
element handler
for that element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PackageNamespaceElementMapper(ElementListener<T> defaultElementHandler, PackageNamespaceElementMapper.NamespaceEntry<T>[] namespaceEntry)
Construct an element mapper to invoke element handlers in the Java package that corresponds to the element namespace, specifying a default element handler for elements outside any of the namespaces.
PackageNamespaceElementMapper.DuplicateNamespaceException
- if two namespace entries have the
same namespace identifier.
NullPointerException
- if any parameter is nullMethod Detail |
---|
public void doElement(T parser, CurrentElement element) throws ListenerException, IOException
Receive a request to handle a element
that is
being parsed, and invoke the appropriate
element handler
for that element.
Warning: This method uses reflection to load the required
subclass of ElementListener<T extends Parser>
. The
class is loaded as a raw type without checking type parameter
T
, beyond ensuring that it is a subclass of
Parser
. A type mismatch on the loaded subclass
T
of the Parser
superclass will not show up
until runtime, and is likely to show up as a problem with a method of
subclass T
that is either not defined, or defined
differently in the Parser
superclass.
doElement
in interface ElementListener<T extends Parser>
doElement
in interface ElementMapper<T extends Parser>
parser
- The Parser
that invoked this methodelement
- CurrentElement
instance with a
content handler
to parse the centent of the element.
ListenerException
- when the exception has been thrown from a
Listener
method.
IOException
- when an input or output error occurs
|
GXPARSE download | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |