com.format.xml
API has been deprecated. Instead, use the com.format.xml.bind
API.public abstract class ALcdXMLElementReader extends Object implementsILcdXMLElementReader
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 savedConstructor and Description |
---|
ALcdXMLElementReader(ILcdXMLElementReaderProvider aElementReaderProvider,
ILcdXMLObjectFactoryProvider aObjectFactoryProvider)
Deprecated.
Creates a new reader.
|
Modifier and Type | Method and Description |
---|---|
void |
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 |
createContext()
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 the
handleChild method
|
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. |
protected void |
finalizeObject(ILcdXMLNameStack aElementStack,
ILcdXMLDocumentContext aContex)
Deprecated.
Finalizes the current object.
|
ILcdXMLElementReader |
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 |
getElementReaderProvider()
Deprecated.
Returns the
ILcdXMLElementReaderProvider that is used by this reader. |
protected ILcdXMLObjectFactoryProvider |
getObjectFactoryProvider()
Deprecated.
Returns the
ILcdXMLObjectFactoryProvider that is used by this reader. |
void |
handleChild(ILcdXMLNameStack aElementStack,
Object aObject,
ILcdXMLDocumentContext aContext)
Deprecated.
Is called by
endChildElement 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:
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. |
public ALcdXMLElementReader(ILcdXMLElementReaderProvider aElementReaderProvider, ILcdXMLObjectFactoryProvider aObjectFactoryProvider)
aElementReaderProvider
- The provider to be used for lookup of child readers.aObjectFactoryProvider
- The provider to be used for creation of new object instances.public void startElement(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, Object aObject, ILcdXMLDocumentContext aContext)
createContext()
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.initObject(ILcdXMLNameStack aElementStack,
ILcdAssocSet aAttributes)
startElement
in interface ILcdXMLElementReader
aElementStack
- aAttributes
- aObject
- aContext
- public Object endElement(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContext)
endElement
method of the supertype's reader, if there is onefinalizeObject
endElement
in interface ILcdXMLElementReader
aElementStack
- aContext
- public void endChildElement(ILcdXMLNameStack aElementStack, ILcdXMLElementReader aElementReader, Object aObject, ILcdXMLDocumentContext aContext)
handleChild
methodendChildElement
in interface ILcdXMLElementReader
aElementStack
- aElementReader
- aObject
- aContext
- public ILcdXMLElementReader getChildReader(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext)
getChildReader
in interface ILcdXMLElementReader
aElementStack
- aAttributes
- aContext
- public void content(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext)
aElementStack
- aContent
- aContext
- public void content(ILcdXMLNameStack aElementStack, char[] chars, int start, int length, ILcdXMLDocumentContext aContext)
ILcdXMLElementReader
aLength == -1
, to indicate that the content block has ended.content
in interface ILcdXMLElementReader
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.protected boolean isTrimContent(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext)
true
.aElementStack
- the current element name stack.aContent
- the content to be processed.aContext
- the document context.true
if the content should be trimmed, false
otherwise.protected Object createObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext)
null
is returned.aAttributes
- protected void initObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext)
aAttributes
- public void handleChild(ILcdXMLNameStack aElementStack, Object aObject, ILcdXMLDocumentContext aContext)
endChildElement
whenever a child element is finished.aElementStack
- aObject
- aContext
- protected void finalizeObject(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContex)
protected Object getCurrentObject(ILcdXMLDocumentContext aContext)
protected Object createContext()
null
is returned.protected Object getCurrentContext(ILcdXMLDocumentContext aContext)
protected ILcdXMLElementReaderProvider getElementReaderProvider()
ILcdXMLElementReaderProvider
that is used by this reader.ILcdXMLElementReaderProvider
that is used by this reader.protected ILcdXMLObjectFactoryProvider getObjectFactoryProvider()
ILcdXMLObjectFactoryProvider
that is used by this reader.ILcdXMLObjectFactoryProvider
that is used by this reader.