Class TLcdXMLDocumentReader

java.lang.Object
com.luciad.format.xml.TLcdXMLDocumentReader

public class TLcdXMLDocumentReader extends Object
Deprecated.
Use of the com.format.xml API has been deprecated. Instead, use the com.format.xml.bind API.
Utility class that can be used to plug a LuciadLightspeed element reader library into another XML framework. It allows reading a part of an XML document with an existing, non-LuciadLightspeed-based XML decoder, while the reading of another part of the document can be delegated to LuciadLightspeed readers.

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 Details

    • TLcdXMLDocumentReader

      public TLcdXMLDocumentReader(String aSourceName, ILcdXMLElementReaderProvider aReaderProvider)
      Deprecated.
      Creates a new TLcdXMLDocumentReader instance, that will use the given ILcdXMLElementReaderProvider 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

      public ILcdXMLSchemaLocationsMap getSchemaLocationsMap()
      Deprecated.
      Returns the 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).
      Returns:
      the ILcdXMLSchemaLocationsMap that contains all schema locations in the decoded XML documents.
      See Also:
    • setSchemaLocationsMap

      public void setSchemaLocationsMap(ILcdXMLSchemaLocationsMap aSchemaLocationsMap)
      Deprecated.
      Sets the ILcdXMLSchemaLocationsMap in which all schema locations that are declared in the read XML documents should be stored.
      Parameters:
      aSchemaLocationsMap - the ILcdXMLSchemaLocationsMap in which all schema locations declared in XML documents should be stored.
    • setPrefixMap

      public void setPrefixMap(ILcdXMLPrefixMap aPrefixMap)
      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

      public ILcdXMLPrefixMap 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

      public Object getRootObject()
      Deprecated.
      Returns the object, returned by the element reader that handled the topmost element in the document.
    • startPrefix

      public void startPrefix(String aPrefix, String aUri) throws TLcdXMLInterruptedException
      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

      public void endPrefix(String aPrefix) throws TLcdXMLInterruptedException
      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

      public void characters(char[] aChars, int aStart, int aLength) throws TLcdXMLInterruptedException
      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

      public void endElement(String aURI, String aLocalName) throws TLcdXMLInterruptedException
      Deprecated.
      Ends the current element.
      Parameters:
      aURI - the namespace of the current element.
      aLocalName - the local name of the current element.
      Throws:
      TLcdXMLInterruptedException