Interface ILcdXMLElementReader

All Known Implementing Classes:
ALcdXMLElementReader, ALcdXMLTypedElementReader, TLcdXMLDefaultElementReader

public interface ILcdXMLElementReader
Deprecated.
Use of the com.format.xml API has been deprecated. Instead, use the com.format.xml.bind API.
Interface for XML reader classes, used by the XML decoder. A reader gets called each time an element tag or content block (a continuous part of simple content, between two XML tags) is processed by the XML decoder.

Consider the following small sample XML document to illustrate the XML handling mechanism:


 <document version="1">
   <title>
     Hello, World!
   </title>
   This is a text.
 <document>
 

Suppose a document reader DH and title reader TH are registered with an element reader provider.

The following method calls will be performed by the XML decoder, during the decoding process:

  • the element reader for the document element, DH is retrieved from the element reader provider.
  • DH.startElement([document],[version=1])
  • DH.getChildreader([document,child],[])
    (returns TH)
  • TH.startElement([document,child],[])
  • TH.content("Hello, World!")
  • TH.endElement([document,child])
    (returns the created titleObject)
  • DH.endChildElement([document,child],TH,titleObject)
  • DH.content("This is a text.")
  • DH.endElement([document]
    (returns the created documentObject)
See Also:
  • Method Details

    • startElement

      void startElement(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, Object aObject, ILcdXMLDocumentContext aContext)
      Deprecated.
      Reports the start of the root element of the structure being handled.

      The attributes attached to the element are available through an immutable ILcdAssocSet. Only the following methods of this interface are available:

      • public int size()
      • public boolean hasValue(Object aObject)
      • public Object getValue(Object aKey)
      • public Enumeration keys()
      • public Enumeration elements()
      An UnsupportedOperationException will be thrown if one of the other methods is called.
      Parameters:
      aElementStack - The current element name stack, including the element that is started on top.
      aAttributes - The attributes of the element.
      aObject - The object to be filled in and returned by this reader. If null,
      aContext - The document context for the XML document currently being decoded.
    • endElement

      Object endElement(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContext)
      Deprecated.
      Reports the end of the root element of the structure being handled.
      Parameters:
      aElementStack - The current element name stack, including the element that is ended on top.
      aContext - The document context for the XML document currently being decoded.
      Returns:
      the object that is created (or filled) by this reader for the element.
    • getChildReader

      ILcdXMLElementReader getChildReader(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext)
      Deprecated.
      Reports the start of a child element and requests a reader to process it. It can either return a separate reader to be used for the child element structure, or handle the child directly (by returning itself).

      The attributes attached to the element are available through an immutable ILcdAssocSet. Only the following methods of the interface are available:

      • public int size()
      • public boolean hasValue(Object aObject)
      • public Object getValue(Object aKey)
      • public Enumeration keys()
      • public Enumeration elements()
      An UnsupportedOperationException will be thrown if one of the other methods is called.
      Parameters:
      aElementStack - The current element name stack, including the element that is ended on top.
      aAttributes - The attributes attributes of the current element.
      aContext - The document context for the XML document currently being decoded.
      Returns:
      A reader for the child element structure, or null if no handling is necessary.
    • endChildElement

      void endChildElement(ILcdXMLNameStack aElementStack, ILcdXMLElementReader aElementReader, Object aObject, ILcdXMLDocumentContext aContext)
      Deprecated.
      Reports the end of a child structure that has been processed by the given reader. The object, created by the child, is passed as a parameter.
      Parameters:
      aElementStack - The current element name stack, including the element that is ended on top.
      aElementReader - The reader that was used for the child structure.
      aObject - The object that was created by the child reader.
      aContext - The document context for the XML document currently being decoded.
    • content

      void content(ILcdXMLNameStack aElementStack, char[] aChars, int aStart, int aLength, ILcdXMLDocumentContext aContext)
      Deprecated.
      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.

      Parameters:
      aElementStack - The current element name stack, including the container element for this content on top.
      aChars - The characters.
      aStart - The start position in the character array.
      aLength - The number of characters to use from the character array.
      aContext - The document context for the XML document currently being decoded.