Package com.luciad.format.xml.schema
Class ALcdXMLTypedElementReader
java.lang.Object
com.luciad.format.xml.schema.ALcdXMLTypedElementReader
- All Implemented Interfaces:
ILcdXMLElementReader
Deprecated.
An abstract class implementing
ILcdXMLElementReader
, facilitating
the implementation of custom XML readers and offering support for XML type inheritance,
based on schema information.
Its main functions are:
- to take care of context management: a new reader context and domain model object are created each time an element is started (via an element factory provider).
- to delegate the part of the handling that cannot be performed by this reader, to the super reader (i.e., the reader registered for the XML type of which the type of this reader is an extension or restriction).
void content(ILcdXMLNameStack aElementStack, String aContent)
: handling of simple contentvoid initObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes)
: initialization of a new objectvoid handleChild(ILcdXMLNameStack aElementStack, Object aObject)
: 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
ConstructorDescriptionALcdXMLTypedElementReader
(ILcdXMLTypedElementReaderProvider aTypedElementReaderProvider, ILcdXMLObjectFactoryProvider aTypeFactoryProvider, ILcdXMLSchemaProvider aSchemaProvider, TLcdXMLName aTypeName) Deprecated.Creates a new reader for a global type.ALcdXMLTypedElementReader
(ILcdXMLTypedElementReaderProvider aTypedElementReaderProvider, ILcdXMLObjectFactoryProvider aTypeFactoryProvider, ILcdXMLSchemaProvider aSchemaProvider, TLcdXMLName aTypeName, TLcdXMLName[] aElementNameStack) Deprecated.Creates a new reader for an anonymous type. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canHandleContent
(ILcdXMLDocumentContext aContext) Deprecated.Returnstrue
if this method can handle simple (text) content,false
if content handling should be delegated to an XML base type handler.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.This method is called whenever simple content is parsed and thecanHandleContent()
method returnstrue
.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 aDocumentContext) Deprecated.Creates and returns a new instance for the current element handled by this reader.void
endChildElement
(ILcdXMLNameStack aElementStack, ILcdXMLElementReader aReader, Object aObject, ILcdXMLDocumentContext aContext) Deprecated.This method is called whenever a child element has been finished.endElement
(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContext) Deprecated.Ends an element.protected void
finalizeObject
(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContext) Deprecated.Finalizes the current object.protected ILcdXMLElementReader
Deprecated.Returns the base type reader of this reader, ornull
if none exists.getChildReader
(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext) Deprecated.Tries to find a matching reader for the given child.protected Object
getCurrentContext
(ILcdXMLDocumentContext aContext) Deprecated.Returns the current context.protected Object
getCurrentObject
(ILcdXMLDocumentContext aContext) Deprecated.Returns the current object.protected ILcdXMLTypedElementReaderProvider
Deprecated.Returns theILcdXMLTypereaderProvider
that is used by this reader.protected ILcdXMLObjectFactoryProvider
Deprecated.Returns theILcdXMLTypeFactoryProvider
that is used by this reader.protected ILcdXMLSchemaProvider
Deprecated.Returns theILcdXMLSchemaProvider
that is used by this reader.protected TLcdXMLSchemaUtil
Deprecated.Returns an XML util instance, initialized with the proper schema provider.void
handleChild
(ILcdXMLNameStack aElementStack, Object aObject, ILcdXMLDocumentContext aContext) Deprecated.Is called byendChildreader
whenever a child element is finished, that is supported by this reader.protected void
initObject
(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext) Deprecated.Initializes a newly created object.protected boolean
isSupportedAttribute
(TLcdXMLName aAttributeName) Deprecated.protected boolean
isSupportedChild
(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContext) Deprecated.Returnstrue
if the given element is a supported child (i.e., if this reader can take the necessary steps to store the object that is created by the child's reader.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
-
ALcdXMLTypedElementReader
public ALcdXMLTypedElementReader(ILcdXMLTypedElementReaderProvider aTypedElementReaderProvider, ILcdXMLObjectFactoryProvider aTypeFactoryProvider, ILcdXMLSchemaProvider aSchemaProvider, TLcdXMLName aTypeName) Deprecated.Creates a new reader for a global type.- Parameters:
aTypedElementReaderProvider
- The provider to be used for lookup of child readers.aTypeFactoryProvider
- The provider to be used for creation of new object instances.aSchemaProvider
- The provider to be used for lookup of XML type hierarchies.aTypeName
- Each time an element stack is started, whose top element matches this type, a new context and domain model object will be created.
-
ALcdXMLTypedElementReader
public ALcdXMLTypedElementReader(ILcdXMLTypedElementReaderProvider aTypedElementReaderProvider, ILcdXMLObjectFactoryProvider aTypeFactoryProvider, ILcdXMLSchemaProvider aSchemaProvider, TLcdXMLName aTypeName, TLcdXMLName[] aElementNameStack) Deprecated.Creates a new reader for an anonymous type.- Parameters:
aTypedElementReaderProvider
- The provider to be used for lookup of child readers.aTypeFactoryProvider
- The provider to be used for creation of new object instances.aSchemaProvider
- The provider to be used for lookup of XML type hierarchies.aTypeName
- The closest global ancestor type in which the anonymous type is contained, ornull
if there is no ancestor element defined by a global type (i.e., all ancestor elements of the type have an anonymous type).aElementNameStack
- The list of element names that identify the anonymous type, starting from the top-most global element or one of the child element of the given global type.
-
-
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
, that object will be registered with the current context as the current object to work on. - call the
startElement
method of the base type's reader, if there is one, with the current object as last parameter. Attributes supported by this handled will be filtered out when delegating to the base type's reader. - initialize the object, by calling
initObject(TLcdXMLGlobalName aElement, 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. This performs the following steps:- call the
endElement
method of the base type'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
-
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.
-
content
public void content(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext) Deprecated.This method is called whenever simple content is parsed and thecanHandleContent()
method returnstrue
. The default implementation does nothing.- Parameters:
aElementStack
-aContent
-aContext
-
-
canHandleContent
Deprecated.Returnstrue
if this method can handle simple (text) content,false
if content handling should be delegated to an XML base type handler. By default, returnsfalse
.- Returns:
true
if this method can handle simple content,false
otherwise.
-
isTrimContent
protected boolean isTrimContent(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext) Deprecated.Returns whether content should be trimmed or not. By default, returnsfalse
if the type has mixed content,true
otherwise.- 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.
-
getChildReader
public ILcdXMLElementReader getChildReader(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext) Deprecated.Tries to find a matching reader for the given child.- If the child is supported by this reader (
isSupportedChild(child)
returnstrue
), returns the reader provided by the element reader provider. - If the child isn't supported, tries to get a child reader from the base type reader, if there is one.
- Else, return
null
.
- Specified by:
getChildReader
in interfaceILcdXMLElementReader
- Parameters:
aElementStack
-aAttributes
-aContext
-- Returns:
- a child reader for the given child.
- If the child is supported by this reader (
-
endChildElement
public void endChildElement(ILcdXMLNameStack aElementStack, ILcdXMLElementReader aReader, Object aObject, ILcdXMLDocumentContext aContext) Deprecated.This method is called whenever a child element has been finished. The following steps are performed:- If the child is a supported child,
handleChild
is called with the corresponding child element name (if the child element was substituted, the originally registered child name is passed, not the substituted name) and the object that was created by the child reader. - Else, if there is a supertype reader, the call is forwarded to the
endChildreader
method of the supertype's readers.
- Specified by:
endChildElement
in interfaceILcdXMLElementReader
- Parameters:
aElementStack
-aReader
-aObject
-aContext
-
- If the child is a supported child,
-
isSupportedChild
Deprecated.Returnstrue
if the given element is a supported child (i.e., if this reader can take the necessary steps to store the object that is created by the child's reader. A child is supported if either:- the child element belongs to the substitution group of one of the substitutable children of this element (only globally defined elements are substitutable)
- or the child element matches one of the locally defined childs of this element.
- Parameters:
aElementStack
-- Returns:
true
if the given element is supported by this reader,false
otherwise.
-
isSupportedAttribute
Deprecated. -
getBaseTypeReader
Deprecated.Returns the base type reader of this reader, ornull
if none exists. This is done by climbing up the type hierarchy (type.getSuperType()
) until a type is found for which a reader is registered with the type reader provider.- Returns:
- the super reader of this reader.
-
createObject
protected Object createObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aDocumentContext) 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. If the created object returned by the object factory is an instance of ILcdXMLEditableElement, it will also set the correct XML name on the element.- Parameters:
aAttributes
-aDocumentContext
-- 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
-aContext
-
-
handleChild
public void handleChild(ILcdXMLNameStack aElementStack, Object aObject, ILcdXMLDocumentContext aContext) Deprecated.Is called byendChildreader
whenever a child element is finished, that is supported by this reader. If the element was substituted, the original element name, registered with this reader, is passed.- Parameters:
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 theILcdXMLTypereaderProvider
that is used by this reader.- Returns:
- the
ILcdXMLTypereaderProvider
that is used by this reader.
-
getObjectFactoryProvider
Deprecated.Returns theILcdXMLTypeFactoryProvider
that is used by this reader.- Returns:
- the
ILcdXMLTypeFactoryProvider
that is used by this reader.
-
getXMLSchemaUtil
Deprecated.Returns an XML util instance, initialized with the proper schema provider.- Returns:
- XML util
-
getSchemaProvider
Deprecated.Returns theILcdXMLSchemaProvider
that is used by this reader.- Returns:
- the
ILcdXMLSchemaProvider
that is used by this reader.
-
com.format.xml.schema
API has been deprecated. Instead, use thecom.format.xml.bind.schema
API.