com.format.xml
API has been deprecated. Instead, use the com.format.xml.bind
API.public class TLcdXMLDocumentReader extends Object
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:
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 and Description |
---|
TLcdXMLDocumentReader(String aSourceName,
ILcdXMLElementReaderProvider aReaderProvider)
Deprecated.
Creates a new
TLcdXMLDocumentReader instance, that will use the given
ILcdXMLElementReaderProvider to retrieve its root element reader. |
Modifier and Type | Method and Description |
---|---|
void |
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 |
endPrefix(String aPrefix)
Deprecated.
Ends the aPrefix mapping of the given aPrefix for all following elements.
|
ILcdXMLPrefixMap |
getPrefixMap()
Deprecated.
Returns the prefix map that is used by this document reader.
|
Object |
getRootObject()
Deprecated.
Returns the object, returned by the element reader that handled the topmost element in the
document.
|
ILcdXMLSchemaLocationsMap |
getSchemaLocationsMap()
Deprecated.
Returns the
ILcdXMLSchemaLocationsMap 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 the
ILcdXMLSchemaLocationsMap 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.
|
public TLcdXMLDocumentReader(String aSourceName, ILcdXMLElementReaderProvider aReaderProvider)
TLcdXMLDocumentReader
instance, that will use the given
ILcdXMLElementReaderProvider
to retrieve its root element reader.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 readerpublic ILcdXMLSchemaLocationsMap getSchemaLocationsMap()
ILcdXMLSchemaLocationsMap
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).ILcdXMLSchemaLocationsMap
that contains all schema locations in the
decoded XML documents.getSchemaLocationsMap()
public void setSchemaLocationsMap(ILcdXMLSchemaLocationsMap aSchemaLocationsMap)
ILcdXMLSchemaLocationsMap
in which all schema locations that are
declared in the read XML documents should be stored.aSchemaLocationsMap
- the ILcdXMLSchemaLocationsMap
in which all schema
locations declared in XML documents should be stored.public void setPrefixMap(ILcdXMLPrefixMap aPrefixMap)
aPrefixMap
- the prefix map to be used by document reader..getPrefixMap()
public ILcdXMLPrefixMap getPrefixMap()
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).public Object getRootObject()
public void startPrefix(String aPrefix, String aUri) throws TLcdXMLInterruptedException
aPrefix
- the XML prefix to be declared.aUri
- the URI on which the prefix is mapped.TLcdXMLInterruptedException
public void endPrefix(String aPrefix) throws TLcdXMLInterruptedException
aPrefix
- the XML prefix to be ended.TLcdXMLInterruptedException
public void startElement(String aURI, String aLocalName, ILcdAssocSet aAttributes) throws TLcdXMLInterruptedException
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.TLcdXMLInterruptedException
public void characters(char[] aChars, int aStart, int aLength) throws TLcdXMLInterruptedException
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.TLcdXMLInterruptedException
public void endElement(String aURI, String aLocalName) throws TLcdXMLInterruptedException
aURI
- the namespace of the current element.aLocalName
- the local name of the current element.TLcdXMLInterruptedException