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
ConstructorsConstructorDescriptionALcdXMLTypedElementReader(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 TypeMethodDescriptionbooleancanHandleContent(ILcdXMLDocumentContext aContext) Deprecated.Returnstrueif this method can handle simple (text) content,falseif content handling should be delegated to an XML base type handler.voidcontent(ILcdXMLNameStack aElementStack, char[] chars, int start, int length, ILcdXMLDocumentContext aContext) Deprecated.Reports some simple character content to be processed.voidcontent(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext) Deprecated.This method is called whenever simple content is parsed and thecanHandleContent()method returnstrue.protected ObjectDeprecated.Creates a new context, that can be used by the reader to store intermediate information during the handling of an element.protected ObjectcreateObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aDocumentContext) Deprecated.Creates and returns a new instance for the current element handled by this reader.voidendChildElement(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 voidfinalizeObject(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContext) Deprecated.Finalizes the current object.protected ILcdXMLElementReaderDeprecated.Returns the base type reader of this reader, ornullif none exists.getChildReader(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext) Deprecated.Tries to find a matching reader for the given child.protected ObjectgetCurrentContext(ILcdXMLDocumentContext aContext) Deprecated.Returns the current context.protected ObjectgetCurrentObject(ILcdXMLDocumentContext aContext) Deprecated.Returns the current object.protected ILcdXMLTypedElementReaderProviderDeprecated.Returns theILcdXMLTypereaderProviderthat is used by this reader.protected ILcdXMLObjectFactoryProviderDeprecated.Returns theILcdXMLTypeFactoryProviderthat is used by this reader.protected ILcdXMLSchemaProviderDeprecated.Returns theILcdXMLSchemaProviderthat is used by this reader.protected TLcdXMLSchemaUtilDeprecated.Returns an XML util instance, initialized with the proper schema provider.voidhandleChild(ILcdXMLNameStack aElementStack, Object aObject, ILcdXMLDocumentContext aContext) Deprecated.Is called byendChildreaderwhenever a child element is finished, that is supported by this reader.protected voidinitObject(ILcdXMLNameStack aElementStack, ILcdAssocSet aAttributes, ILcdXMLDocumentContext aContext) Deprecated.Initializes a newly created object.protected booleanisSupportedAttribute(TLcdXMLName aAttributeName) Deprecated.protected booleanisSupportedChild(ILcdXMLNameStack aElementStack, ILcdXMLDocumentContext aContext) Deprecated.Returnstrueif 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 booleanisTrimContent(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext) Deprecated.Returns whether content should be trimmed or not.voidstartElement(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, ornullif 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
aObjectisnull, create a new object, by callingcreateObject(TLcdXMLGlobalName aELementName, ILcdAssocSet aAttributes), and registered as the current object. IfaObjectisn'tnull, that object will be registered with the current context as the current object to work on. - call the
startElementmethod 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:
startElementin 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
endElementmethod 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:
endElementin 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:ILcdXMLElementReaderReports 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:
contentin 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.Returnstrueif this method can handle simple (text) content,falseif content handling should be delegated to an XML base type handler. By default, returnsfalse.- Returns:
trueif this method can handle simple content,falseotherwise.
-
isTrimContent
protected boolean isTrimContent(ILcdXMLNameStack aElementStack, String aContent, ILcdXMLDocumentContext aContext) Deprecated.Returns whether content should be trimmed or not. By default, returnsfalseif the type has mixed content,trueotherwise.- Parameters:
aElementStack- the current element name stack.aContent- the content to be processed.aContext- the document context.- Returns:
trueif the content should be trimmed,falseotherwise.
-
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:
getChildReaderin 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,
handleChildis 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
endChildreadermethod of the supertype's readers.
- Specified by:
endChildElementin interfaceILcdXMLElementReader- Parameters:
aElementStack-aReader-aObject-aContext-
- If the child is a supported child,
-
isSupportedChild
Deprecated.Returnstrueif 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:
trueif the given element is supported by this reader,falseotherwise.
-
isSupportedAttribute
Deprecated. -
getBaseTypeReader
Deprecated.Returns the base type reader of this reader, ornullif 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,nullis 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 byendChildreaderwhenever 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,nullis 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 theILcdXMLTypereaderProviderthat is used by this reader.- Returns:
- the
ILcdXMLTypereaderProviderthat is used by this reader.
-
getObjectFactoryProvider
Deprecated.Returns theILcdXMLTypeFactoryProviderthat is used by this reader.- Returns:
- the
ILcdXMLTypeFactoryProviderthat is used by this reader.
-
getXMLSchemaUtil
Deprecated.Returns an XML util instance, initialized with the proper schema provider.- Returns:
- XML util
-
getSchemaProvider
Deprecated.Returns theILcdXMLSchemaProviderthat is used by this reader.- Returns:
- the
ILcdXMLSchemaProviderthat is used by this reader.
-
com.format.xml.schemaAPI has been deprecated. Instead, use thecom.format.xml.bind.schemaAPI.