Package com.luciad.format.xml
Class ALcdXMLElementReader
java.lang.Object
com.luciad.format.xml.ALcdXMLElementReader
- All Implemented Interfaces:
ILcdXMLElementReader
- Direct Known Subclasses:
TLcdXMLDefaultElementReader
Deprecated.
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 contentvoid initObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes)
: initialization of a new objectvoid endChildElement(ILcdXMLNameStack aElementStack, ILcdXMLElementReader aElementReader, Object aObject, ILcdXMLDocumentContext aContext)
: handling of a child elementvoid finalizeObject(ILcdXMLNameStack aElementStack)
: finalization of the current objectObject createContext()
: creation of a context, in which temporary information can be saved
-
Constructor Summary
ConstructorDescriptionALcdXMLElementReader
(ILcdXMLElementReaderProvider aElementReaderProvider, ILcdXMLObjectFactoryProvider aObjectFactoryProvider) Deprecated.Creates a new reader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
content
(ILcdXMLNameStack aElementStack, char[] chars, int start, int length, ILcdXMLDocumentContext aContext) Deprecated.Reports some simple character content to be processed.void
content
(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext) Deprecated.Default implementation, doing nothing.protected Object
Deprecated.Creates a new context, that can be used by the reader to store intermediate information during the handling of an element.protected Object
createObject
(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext) Deprecated.Creates and returns a new instance for the current element handled by this reader.void
endChildElement
(ILcdXMLNameStack aElementStack, ILcdXMLElementReader aElementReader, Object aObject, ILcdXMLDocumentContext aContext) Deprecated.Ends a child element, performing the following steps: calls thehandleChild
methodendElement
(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContext) Deprecated.Ends an element, performing these steps:protected void
finalizeObject
(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContex) Deprecated.Finalizes the current object.getChildReader
(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext) Deprecated.By default, returns the child reader provider by the element reader provider.protected Object
getCurrentContext
(ILcdXMLDocumentContext aContext) Deprecated.Returns the current context.protected Object
getCurrentObject
(ILcdXMLDocumentContext aContext) Deprecated.Returns the current object.protected ILcdXMLElementReaderProvider
Deprecated.Returns theILcdXMLElementReaderProvider
that is used by this reader.protected ILcdXMLObjectFactoryProvider
Deprecated.Returns theILcdXMLObjectFactoryProvider
that is used by this reader.void
handleChild
(ILcdXMLNameStack aElementStack, Object aObject, ILcdXMLDocumentContext aContext) Deprecated.Is called byendChildElement
whenever a child element is finished.protected void
initObject
(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext) Deprecated.Initializes a newly created object.protected boolean
isTrimContent
(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext) Deprecated.Returns whether content should be trimmed or not.void
startElement
(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, Object aObject, ILcdXMLDocumentContext aContext) Deprecated.Starts a new element, and performs the following steps:
-
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
isnull
, create a new object, by callingcreateObject(TLcdXMLGlobalName aELementName, ILcdAssocSet aAttributes)
, and registered as the current object. IfaObject
isn'tnull
, this object will be registered with the current context. - initialize the object, by calling
initObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes)
- Specified by:
startElement
in interfaceILcdXMLElementReader
- Parameters:
aElementStack
-aAttributes
-aObject
-aContext
-
- create a new context for this element, by calling
-
endElement
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
- Specified by:
endElement
in interfaceILcdXMLElementReader
- Parameters:
aElementStack
-aContext
-- Returns:
- the object constructed by this reader (or one of its subtype readers) for the element.
- call the
-
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 interfaceILcdXMLElementReader
- Parameters:
aElementStack
-aElementReader
-aObject
-aContext
-
- calls the
-
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 interfaceILcdXMLElementReader
- 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 withaLength == -1
, to indicate that the content block has ended.- Specified by:
content
in interfaceILcdXMLElementReader
- 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, returnstrue
.- 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 byendChildElement
whenever a child element is finished.- Parameters:
aElementStack
-aObject
-aContext
-
-
finalizeObject
Deprecated.Finalizes the current object. -
getCurrentObject
Deprecated.Returns the current object.- Returns:
- the current 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
Deprecated.Returns the current context.- Returns:
- the context for the current element
-
getElementReaderProvider
Deprecated.Returns theILcdXMLElementReaderProvider
that is used by this reader.- Returns:
- the
ILcdXMLElementReaderProvider
that is used by this reader.
-
getObjectFactoryProvider
Deprecated.Returns theILcdXMLObjectFactoryProvider
that is used by this reader.- Returns:
- the
ILcdXMLObjectFactoryProvider
that is used by this reader.
-
com.format.xml
API has been deprecated. Instead, use thecom.format.xml.bind
API.