Class TLcdXMLDocumentReader
A typical usage scenario is an application that reads a custom-defined XML document, in which a GML3 part is embedded:
<my:document>
<my:Content>
...
</my:Content>
<gml:featureCollection>
...
</gml:featureCollection>
</my:document>
When a SAX ContentHandler
already exists for the elements in the my
namespace, the TLcdXMLDocumentReader
class can be used to delegate the decoding
of the GML3 part of the document to the LuciadLightspeed GML3 decoder library.
At the moment the SAX ContentHandler encounters the gml:featureCollection
element,
it will need to forward all following XML event calls to the TLcdXMLDocumentReader
instance, until the closing tag of the same gml:featureCollection
element is processed.
The following XML event calls need to be forwarded to the TLcdXMLDocumentReader
instance:
- startPrefix()
- endPrefix()
- startElement()
- endElement()
- characters()
After the last endElement()
call has been forwarded (in the example, after the
gml:featurecollection
element has been ended), the resulting object can be retrieved
from the TLcdXMLDocumentReader
instance using the getRootObject()
method.
If some prefix mappings or schema locations are defined outside the XML part that is handled
by the TLcdXMLDocumentReader
instance, but used inside that part, a valid prefix
and schema locations map need to be set on the reader.
-
Constructor Summary
ConstructorDescriptionTLcdXMLDocumentReader
(String aSourceName, ILcdXMLElementReaderProvider aReaderProvider) Deprecated.Creates a newTLcdXMLDocumentReader
instance, that will use the givenILcdXMLElementReaderProvider
to retrieve its root element reader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] aChars, int aStart, int aLength) Deprecated.Processes a subarray of the given array of characters as XML content in the currently active XML element, starting at position aStart and with length aLength.void
endElement
(String aURI, String aLocalName) Deprecated.Ends the current element.void
Deprecated.Ends the aPrefix mapping of the given aPrefix for all following elements.Deprecated.Returns the prefix map that is used by this document reader.Deprecated.Returns the object, returned by the element reader that handled the topmost element in the document.Deprecated.Returns theILcdXMLSchemaLocationsMap
that contains all schema locations read during the decoding of XML documents.void
setPrefixMap
(ILcdXMLPrefixMap aPrefixMap) Deprecated.Sets the prefix map to be used by this document reader.void
setSchemaLocationsMap
(ILcdXMLSchemaLocationsMap aSchemaLocationsMap) Deprecated.Sets theILcdXMLSchemaLocationsMap
in which all schema locations that are declared in the read XML documents should be stored.void
startElement
(String aURI, String aLocalName, ILcdAssocSet aAttributes) Deprecated.Starts a new XML element.void
startPrefix
(String aPrefix, String aUri) Deprecated.Starts a new aPrefix mapping for all following elements.
-
Constructor Details
-
TLcdXMLDocumentReader
Deprecated.Creates a newTLcdXMLDocumentReader
instance, that will use the givenILcdXMLElementReaderProvider
to retrieve its root element reader.- Parameters:
aSourceName
- the source name of the XML document that is being processed. All resources (XML schemas) specified by a relative URL in the document, will be resolved with respect to this source.aReaderProvider
- the element reader provider that will provide this document reader with a root element reader
-
-
Method Details
-
getSchemaLocationsMap
Deprecated.Returns theILcdXMLSchemaLocationsMap
that contains all schema locations read during the decoding of XML documents. Each schema location declaration (xsi:schemaLocations="..."
), read during the decoding, will be added to the schema locations map. This way, the schema locations of the original XML document can be shared with other applications (e.g., an XML encoder).- Returns:
- the
ILcdXMLSchemaLocationsMap
that contains all schema locations in the decoded XML documents. - See Also:
-
setSchemaLocationsMap
Deprecated.Sets theILcdXMLSchemaLocationsMap
in which all schema locations that are declared in the read XML documents should be stored.- Parameters:
aSchemaLocationsMap
- theILcdXMLSchemaLocationsMap
in which all schema locations declared in XML documents should be stored.
-
setPrefixMap
Deprecated.Sets the prefix map to be used by this document reader.- Parameters:
aPrefixMap
- the prefix map to be used by document reader..- See Also:
-
getPrefixMap
Deprecated.Returns the prefix map that is used by this document reader. Each time the document reader reads an XML prefix declaration (xmlns:prefix="namespace"
), the prefix, together with its corresponding namespace, will be added to the prefix map. This way, the prefix mapping of the original XML document can be shared with other applications (e.g., an XML encoder).- Returns:
- the prefix map that is used by this document reader.
-
getRootObject
Deprecated.Returns the object, returned by the element reader that handled the topmost element in the document. -
startPrefix
Deprecated.Starts a new aPrefix mapping for all following elements.- Parameters:
aPrefix
- the XML prefix to be declared.aUri
- the URI on which the prefix is mapped.- Throws:
TLcdXMLInterruptedException
-
endPrefix
Deprecated.Ends the aPrefix mapping of the given aPrefix for all following elements.- Parameters:
aPrefix
- the XML prefix to be ended.- Throws:
TLcdXMLInterruptedException
-
startElement
public void startElement(String aURI, String aLocalName, ILcdAssocSet aAttributes) throws TLcdXMLInterruptedException Deprecated.Starts a new XML element. The attributes should be passed as an ILcdAssocSet, containing a map of <TLcdXMLName attribute name, String value> key pairs.- Parameters:
aURI
- the namespace of the XML element to be started.aLocalName
- the local name of the XML element to be started.aAttributes
- the attributes of the XML element to be started.- Throws:
TLcdXMLInterruptedException
-
characters
Deprecated.Processes a subarray of the given array of characters as XML content in the currently active XML element, starting at position aStart and with length aLength.- Parameters:
aChars
- the character array, containing the content to be processed.aStart
- the index of the first character to be processed.aLength
- the length of the character array to be processed.- Throws:
TLcdXMLInterruptedException
-
endElement
Deprecated.Ends the current element.- Parameters:
aURI
- the namespace of the current element.aLocalName
- the local name of the current element.- Throws:
TLcdXMLInterruptedException
-
com.format.xml
API has been deprecated. Instead, use thecom.format.xml.bind
API.