Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.javatools.xml.esax.spi
Class DefaultElementContext

java.lang.Object
  extended by oracle.javatools.xml.esax.spi.DefaultElementContext

All Implemented Interfaces:
ElementContext, ElementEndContext, ElementStartContext

public class DefaultElementContext
extends java.lang.Object
implements ElementContext, ElementStartContext, ElementEndContext

A default XML context implementation. This provides access to methods that change the context and should only be used by ExtensibleSAXHandler.


Constructor Summary
DefaultElementContext()
           

 

Method Summary
 java.util.Iterator getAttributeNames()
          Iterates over the collection of attribute names for the element in context.
 java.lang.String getAttributeValue(java.lang.String attributeName)
          Get the value of an attribute for this element.
 java.lang.String getLocalName()
          Get the local name of the current element.
 XMLLocator getLocator()
          Get the locator for the EDD being parsed.
 MessageReporter getMessageReporter()
          Get the message reporter.
 java.lang.String getNamespaceURI()
          Get the namespace URI of the current element.
 java.lang.String getParentLocalName()
          Get the local name of the parent element, if any.
 java.lang.String getPath()
          Get the path to the current element.
 ElementHandler getScopedHandler()
          Get a scoped handler for the current element (if any)
 java.lang.String getText()
          Get the text contained in this element.
 java.lang.Object getValue(Key key)
          Get a value stored in this context.
 void putValue(Key key, java.lang.Object value)
          Store a value in this context.
 void registerChildHandler(java.lang.String namespaceURI, java.lang.String localName, ElementHandler handler)
          Register a handler that will be used only for immediate children of the current element.
 void registerScopeHandler(java.lang.String localElementName, ElementHandler handler)
          Register a handler that will bs used within the scope of the current element and all its descendants.
 void registerScopeHandler(java.lang.String namespaceURI, java.lang.String localElementName, ElementHandler handler)
          Register a handler that will bs used within the scope of the current element and all its descendants.
 void registerScopeHandlerFactory(ElementHandlerFactory factory)
          Register a factory that can dynamically retrieve element handlers for XML elements in the current scope.
 void removeValue(Key key)
          Clear a value from this context.
 void setMessageReporter(MessageReporter reporter)
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

DefaultElementContext

public DefaultElementContext()

Method Detail

getLocalName

public java.lang.String getLocalName()
Get the local name of the current element.
Specified by:
getLocalName in interface ElementContext
Returns:
the local name of the current element.

getNamespaceURI

public java.lang.String getNamespaceURI()
Get the namespace URI of the current element.
Specified by:
getNamespaceURI in interface ElementContext
Returns:
the namespace URI of the current element.

getPath

public java.lang.String getPath()
Get the path to the current element.
Returns:
an expression identifying the current element within the document. This is a pseudo-xpath that does not include namespace information.

getParentLocalName

public java.lang.String getParentLocalName()
Get the local name of the parent element, if any.
Specified by:
getParentLocalName in interface ElementContext
Returns:
the local name of the parent element, or the empty string if this element is the root.

getText

public java.lang.String getText()
Get the text contained in this element. It's only valid to call this from EDDElementHandler.handleEndElement.
Specified by:
getText in interface ElementEndContext

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String attributeName)
Get the value of an attribute for this element. It's only valid to call this from EDDElementHandler.handleStartElement.
Specified by:
getAttributeValue in interface ElementStartContext
Parameters:
attributeName - the local name of an XML attribute, must not be null.
Returns:
the value of the specified attribute, or null if not present.

getAttributeNames

public java.util.Iterator getAttributeNames()
Iterates over the collection of attribute names for the element in context.
Specified by:
getAttributeNames in interface ElementStartContext
Returns:
a java.util.Iterator of all attribute names.

getValue

public java.lang.Object getValue(Key key)
Get a value stored in this context.
Specified by:
getValue in interface ElementContext
Parameters:
key - a key for the stored value
Returns:
the stored value, or null if no such value is stored, or the value is stored as null.

putValue

public void putValue(Key key,
                     java.lang.Object value)
Store a value in this context.
Specified by:
putValue in interface ElementContext
Parameters:
key - a key for the value.
value - the value to store, can be null.

removeValue

public void removeValue(Key key)
Clear a value from this context. This *only* acts on the current scope level.
Specified by:
removeValue in interface ElementContext

registerChildHandler

public void registerChildHandler(java.lang.String namespaceURI,
                                 java.lang.String localName,
                                 ElementHandler handler)
Register a handler that will be used only for immediate children of the current element.
Specified by:
registerChildHandler in interface ElementContext
Parameters:
namespaceURI -
localName -
handler -

registerScopeHandler

public void registerScopeHandler(java.lang.String localElementName,
                                 ElementHandler handler)
Description copied from interface: ElementContext
Register a handler that will bs used within the scope of the current element and all its descendants. You should normally call this from ElementHandler.beginElement(). Handlers registered this way are static. To register a factory that dynamically retrieves handlers, use the registerScopeHandlerFactory() method.
Specified by:
registerScopeHandler in interface ElementContext
Parameters:
localElementName - the name of the element to handle
handler - the handler to use

registerScopeHandler

public void registerScopeHandler(java.lang.String namespaceURI,
                                 java.lang.String localElementName,
                                 ElementHandler handler)
Description copied from interface: ElementContext
Register a handler that will bs used within the scope of the current element and all its descendants. You should normally call this from ElementHandler.beginElement(). Handlers registered this way are static. To register a factory that dynamically retrieves handlers, use the registerScopeHandlerFactory() method.
Specified by:
registerScopeHandler in interface ElementContext
Parameters:
namespaceURI - the namespace URI of the element to handle
localElementName - the name of the element to handle
handler - the handler to use

registerScopeHandlerFactory

public void registerScopeHandlerFactory(ElementHandlerFactory factory)
Description copied from interface: ElementContext
Register a factory that can dynamically retrieve element handlers for XML elements in the current scope.
Specified by:
registerScopeHandlerFactory in interface ElementContext
Parameters:
factory - the factory to register

getScopedHandler

public ElementHandler getScopedHandler()
Get a scoped handler for the current element (if any)

getLocator

public XMLLocator getLocator()
Get the locator for the EDD being parsed.
Specified by:
getLocator in interface ElementContext
Returns:
the locator for the EDD being parsed

getMessageReporter

public MessageReporter getMessageReporter()
Description copied from interface: ElementContext
Get the message reporter. Normally you only use this for reporting warnings; any thrown HandlerExceptions will be reported automatically.
Specified by:
getMessageReporter in interface ElementContext
Returns:
the parse message reporter.

setMessageReporter

public void setMessageReporter(MessageReporter reporter)
Specified by:
setMessageReporter in interface ElementContext

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.