GXPARSE hosted by SourceForge.net Logo

ca.gorman.xml.parse
Interface ElementMapper<T extends Parser>

All Superinterfaces:
ElementListener<T>
All Known Subinterfaces:
NamespaceMapper<T>
All Known Implementing Classes:
ClassNamespaceElementMapper, ElementClassMapper, NamespacePackageMapper, PackageNamespaceElementMapper, SimpleElementMapper

public interface ElementMapper<T extends Parser>
extends ElementListener<T>

An ElementListener that maps XML element names to element handlers and invokes the appropriate handler for each element.

The handler will be equivalent to the doElement method of an ElementListener.

The mapping may require the transformation of XML element names to different Java names, because some XML name characters cannot be used as Java name characters.

Defines some currency symbols that can be used as "escape" characters when replacing element name characters that cannot be used in Java names. Other characters can also be used if they comply with several requirements:

See Also:
NamespaceMapper

Nested Class Summary
static class ElementMapper.InvalidHandlerException
           Exception thrown when doElement maps an XML name to a Java identifier that cannot be used to invoke an element handler.
static class ElementMapper.NotFoundException
           Exception thrown when doElement maps an XML name to a Java identifier that is not defined by the application.
 
Field Summary
static char ESCAPE_CENT
           Cent (¢) symbol for use in mapping element name characters to characters that can be used as Java name start characters.
static char ESCAPE_CURRENCY
           Currency (¤) symbol for use in mapping element name characters to characters that can be used as Java name start characters.
static char ESCAPE_DOLLAR
           Dollar ($) symbol for use in mapping element name characters to characters that can be used as Java name start characters.
static char ESCAPE_POUND
           Pound Sterling (£) symbol for use in mapping element name characters to characters that can be used as Java name start characters.
static char ESCAPE_YEN
           Yen (¥) symbol for use in mapping element name characters to characters that can be used as Java name start characters.
 
Method Summary
 void doElement(T parser, CurrentElement element)
           Maps an XML element to a handler for the element and invokes the handler on the element.
 

Field Detail

ESCAPE_DOLLAR

static final char ESCAPE_DOLLAR

Dollar ($) symbol for use in mapping element name characters to characters that can be used as Java name start characters.

This character is used by Java in the names of inner classes. The application design must ensure that no XML element name will be mapped to a name that identifies an inner class unless that inner class is an ElementListener.

See Also:
Constant Field Values

ESCAPE_CENT

static final char ESCAPE_CENT

Cent (¢) symbol for use in mapping element name characters to characters that can be used as Java name start characters.

See Also:
Constant Field Values

ESCAPE_POUND

static final char ESCAPE_POUND

Pound Sterling (£) symbol for use in mapping element name characters to characters that can be used as Java name start characters.

See Also:
Constant Field Values

ESCAPE_CURRENCY

static final char ESCAPE_CURRENCY

Currency (¤) symbol for use in mapping element name characters to characters that can be used as Java name start characters.

See Also:
Constant Field Values

ESCAPE_YEN

static final char ESCAPE_YEN

Yen (¥) symbol for use in mapping element name characters to characters that can be used as Java name start characters.

See Also:
Constant Field Values
Method Detail

doElement

void doElement(T parser,
               CurrentElement element)
               throws ListenerException,
                      IOException

Maps an XML element to a handler for the element and invokes the handler on the element.

The handler will be equivalent to the doElement method of an ElementListener.

Specified by:
doElement in interface ElementListener<T extends Parser>
Parameters:
parser - The Parser that invoked this method
element - CurrentElement instance with a content handler to parse the centent of the element.
Throws:
ListenerException - when the exception has been thrown from a Listener method.
ListenerRuntimeException - if this method does not invoke the content handler exactly once before returning.
IOException - when an input or output error occurs
NullPointerException - when any parameter is null
ElementMapper.NotFoundException - when a handler is not found
ElementMapper.InvalidHandlerException - when the element name has been mapped to a handler that cannot be invoked

GXPARSE download

GXPARSE Generic XML Stream Parser API and supporting tools.   Release $Name: gxparse-sf-alpha-2_0 $
Copyright 2003-2004 Ian E. Gorman
Released under GNU Lesser General Public License