Class ALcdXMLElementReader

java.lang.Object
com.luciad.format.xml.ALcdXMLElementReader
All Implemented Interfaces:
ILcdXMLElementReader
Direct Known Subclasses:
TLcdXMLDefaultElementReader

public abstract class ALcdXMLElementReader extends Object implements ILcdXMLElementReader
Deprecated.
Use of the com.format.xml API has been deprecated. Instead, use the com.format.xml.bind API.
An abstract class implementing ILcdXMLElementReader, facilitating the implementation of custom XML readers. Its main function is to take care of context management: a new reader context and domain model object are created each time an element is started.

Extensions of this class should typically override the following methods:

  • void content(ILcdXMLNameStack aElementStack, String aContent): handling of simple content
  • void initObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes): initialization of a new object
  • void endChildElement(ILcdXMLNameStack aElementStack, ILcdXMLElementReader aElementReader, Object aObject, ILcdXMLDocumentContext aContext): handling of a child element
  • void finalizeObject(ILcdXMLNameStack aElementStack): finalization of the current object
  • Object createContext(): creation of a context, in which temporary information can be saved
  • Constructor Details

    • ALcdXMLElementReader

      public ALcdXMLElementReader(ILcdXMLElementReaderProvider aElementReaderProvider, ILcdXMLObjectFactoryProvider aObjectFactoryProvider)
      Deprecated.
      Creates a new reader.
      Parameters:
      aElementReaderProvider - The provider to be used for lookup of child readers.
      aObjectFactoryProvider - The provider to be used for creation of new object instances.
  • Method Details

    • startElement

      public void startElement(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, Object aObject, ILcdXMLDocumentContext aContext)
      Deprecated.
      Starts a new element, and performs the following steps:

      • create a new context for this element, by calling createContext()
      • if aObject is null, create a new object, by calling createObject(TLcdXMLGlobalName aELementName, ILcdAssocSet aAttributes), and registered as the current object. If aObject isn't null, this object will be registered with the current context.
      • initialize the object, by calling initObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes)

      Otherwise, no actions will be performed.

      Specified by:
      startElement in interface ILcdXMLElementReader
      Parameters:
      aElementStack -
      aAttributes -
      aObject -
      aContext -
    • endElement

      public Object endElement(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContext)
      Deprecated.
      Ends an element, performing these steps:

      • call the endElement method of the supertype's reader, if there is one
      • Finalize the object, by calling finalizeObject
      • reestablish the 'current' context and 'current' object that were active just before this element was started

      The 'current' object of this element, is returned.

      Specified by:
      endElement in interface ILcdXMLElementReader
      Parameters:
      aElementStack -
      aContext -
      Returns:
      the object constructed by this reader (or one of its subtype readers) for the element.
    • endChildElement

      public void endChildElement(ILcdXMLNameStack aElementStack, ILcdXMLElementReader aElementReader, Object aObject, ILcdXMLDocumentContext aContext)
      Deprecated.
      Ends a child element, performing the following steps:
      • calls the handleChild method
      Specified by:
      endChildElement in interface ILcdXMLElementReader
      Parameters:
      aElementStack -
      aElementReader -
      aObject -
      aContext -
    • getChildReader

      public ILcdXMLElementReader getChildReader(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext)
      Deprecated.
      By default, returns the child reader provider by the element reader provider.
      Specified by:
      getChildReader in interface ILcdXMLElementReader
      Parameters:
      aElementStack -
      aAttributes -
      aContext -
      Returns:
      a child reader for the given child.
    • content

      public void content(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext)
      Deprecated.
      Default implementation, doing nothing.
      Parameters:
      aElementStack -
      aContent -
      aContext -
    • content

      public void content(ILcdXMLNameStack aElementStack, char[] chars, int start, int length, ILcdXMLDocumentContext aContext)
      Deprecated.
      Description copied from interface: ILcdXMLElementReader
      Reports some simple character content to be processed. Content and children are reported in the order they are present in the original XML document.

      A continuous block of XML characters can be split up by the decoder and passed to this reader in multiple method calls, especially if the character block is large. After the last character(s) of a block have been passed to this reader, the method will be called with aLength == -1, to indicate that the content block has ended.

      Specified by:
      content in interface ILcdXMLElementReader
      Parameters:
      aElementStack - The current element name stack, including the container element for this content on top.
      chars - The characters.
      start - The start position in the character array.
      length - The number of characters to use from the character array.
      aContext - The document context for the XML document currently being decoded.
    • isTrimContent

      protected boolean isTrimContent(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext)
      Deprecated.
      Returns whether content should be trimmed or not. By default, returns true.
      Parameters:
      aElementStack - the current element name stack.
      aContent - the content to be processed.
      aContext - the document context.
      Returns:
      true if the content should be trimmed, false otherwise.
    • createObject

      protected Object createObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext)
      Deprecated.
      Creates and returns a new instance for the current element handled by this reader. If there is an ILcdXMLObjectFactory available in the ILcdXMLObjectFactoryProvider for this type, a new instance is created via the factory, otherwise, null is returned.
      Parameters:
      aAttributes -
      Returns:
      a new instance for the currently handled element
    • initObject

      protected void initObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext)
      Deprecated.
      Initializes a newly created object. The default implementation is empty.
      Parameters:
      aAttributes -
    • handleChild

      public void handleChild(ILcdXMLNameStack aElementStack, Object aObject, ILcdXMLDocumentContext aContext)
      Deprecated.
      Is called by endChildElement whenever a child element is finished.
      Parameters:
      aElementStack -
      aObject -
      aContext -
    • finalizeObject

      protected void finalizeObject(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContex)
      Deprecated.
      Finalizes the current object.
    • getCurrentObject

      protected Object getCurrentObject(ILcdXMLDocumentContext aContext)
      Deprecated.
      Returns the current object.
      Returns:
      the current object
    • createContext

      protected Object createContext()
      Deprecated.
      Creates a new context, that can be used by the reader to store intermediate information during the handling of an element. By default, null is returned.
      Returns:
      a new context for the current element
    • getCurrentContext

      protected Object getCurrentContext(ILcdXMLDocumentContext aContext)
      Deprecated.
      Returns the current context.
      Returns:
      the context for the current element
    • getElementReaderProvider

      protected ILcdXMLElementReaderProvider getElementReaderProvider()
      Deprecated.
      Returns the ILcdXMLElementReaderProvider that is used by this reader.
      Returns:
      the ILcdXMLElementReaderProvider that is used by this reader.
    • getObjectFactoryProvider

      protected ILcdXMLObjectFactoryProvider getObjectFactoryProvider()
      Deprecated.
      Returns the ILcdXMLObjectFactoryProvider that is used by this reader.
      Returns:
      the ILcdXMLObjectFactoryProvider that is used by this reader.