Package org.geotools.xml

Package supporting XML parsing with a focus on GML.

See:
          Description

Interface Summary
AttributeInstance Represents an attribute in an instance document.
Binding A specialized handler for a specific type in an xml schema.
BindingFactory Creates the binding for a qualified name.
BindingWalkerFactory Factory made available to bindings to walk over a bindign execution chain.
ComplexBinding A strategy for parsing elements in an instance document which are of complex type.
ElementInstance Represents an element in an instance document.
EncoderConfiguration Used to configure an instance of org.geotools.xml.Writer.
FlowHandler Provides a mechanism to indicate that the XMLSAXHandler should stop parsing.
InstanceComponent  
Node Represents a value in the parse tree.
Parser.Properties Deprecated.  
PrintHandler PrintHandler accepts SAXish events and generated output.
PropertyExtractor Factory used by the encoder to obtain child values from objects being encoded.
SchemaIndex  
SimpleBinding A strategy for parsing components in an instance document which are of simple type.
 

Class Summary
AbstractComplexBinding Base class for complex bindings.
AbstractComplexEMFBinding Base class for complex bindings which map to an EMF model class.
AbstractSimpleBinding Base class for simple bindings.
ComplexEMFBinding A binding implementation which parses / encodes objects from an EMF model.
Configuration Responsible for configuring a parser runtime environment.
DocumentFactory SchemaFactory purpose.
DocumentWriter This is the thing that writes documents.
DOMParser Parses a DOM (Document Object Model) using the geotools xml binding system.
EMFUtils Utility methods for working with emf model objects.
Encoder Encodes objects as xml based on a schema.
OptionalComponentParameter A pico container "parameter" which allows one to make setter injection optional.
Parser Main interface to the geotools xml parser.
SchemaFactory SchemaFactory purpose.
SchemaLocationResolver Resolves a physical schema location from a namespace uri.
SchemaLocator Helper class which ensures that the xsd schema parser uses pre-build schema objects.
Schemas Utility class for performing various opreations.
SimpleContentComplexEMFBinding A binding implementation which handles the case of a complex type with simple content.
StreamingParser XML parser capable of streaming.
XML This interface contains the qualified names of all the types,elements, and attributes in the http://www.w3.org/XML/1998/namespace schema.
XMLConfiguration Parser configuration for the http://www.w3.org/XML/1998/namespace schema.
XmlConverterFactory A ConverterFactory which can convert strings using DatatypeFactory.
XMLElementHandler XSIElementHandler purpose.
XMLHandlerHints Hint object with known parameters for XML parsing.
XMLSAXHandler XMLSAXHandler purpose.
XPathPropertyAccessorFactory PropertyAccessorFactory used to create property accessors which can handle xpath expressions against instances of Feature.
XSD Xml Schema for a particular namespace.
XSIElementHandler XSIElementHandler purpose.
XSISAXHandler XSISAXHandler purpose.
 

Package org.geotools.xml Description

Package supporting XML parsing with a focus on GML.

The package supports GML version 2.X defined at http://www.opengis.net/gml/. Although the schema and instance parsers appearing in this package can be extended for use in most xml applications, the package was intended to be used as a starting point to parse GML 2.0 documents.

For simplistic parsing requirements, you should refer to the 'Basics' portion of this document. For more complex parsing requirements, or optimizations you should also read 'Extending the Parser'.

Basics

This set of parsers (one xsi + one xml) is intended to parse arbitrary schema defined xml documents. This means that the XML document must have namespace definitions for the document, although there may be one default namespace defined within the document.

When asked to parse an XML instance document, the parser will first defer to another instance to create a Schema instance of the document requested. In some cases the entire Schema, or portions of the Schema, may already be parsed and reside in a cahce. In this case the Schema will not be parsed, otherwise a new instance of the Schema requested will be created and stored. The Schema is important because it is used in the parsing and validation of the XML document.

To complete basic parsing, use the DocumentFactory.getInstance(URI) method. This will return an Object representing the document (undefined ComplexTypes are Object[], simpleTypes are their type parsed ... int is an Integer). In some cases, specific pre-defined namespaces will not return Object[] for complexTypes (such as gml elements, and gml-inherited elements).

Extending the Parser

Parser extensions should be completed for two reasons: either you want it to go faster, or you want specific types to parse information in a specific manner. In either case you should construct a Schema instance, and add it to the SchemaFactory.properties file found in this package. You will note that you will be required to implement any ComplexTypes which are included in your schema, as such providing an opportunity [getValue(Element,ElementValue[],Attributes)] to create your own parsed values.

The framework will automatically get all you children's values and place then in the order parsed into the ElementValue[]. This means that each type is only responsible for interpreting it's own data, removing the need for recursion. Please be careful or unwanted resources staying in memory, as memory usage can grow quickly. I should also note that I make no claims as to Thread safety, and as such you may wish to consider this when creating an extension implementation.

For more information study the interfaces found in the org.geotools.xml.schema package, and an example hardcoded Schema, look in org.geotools.xml.gml .

Credits

Some of the code and design within this package was first though of by Ian Schneider. Much of the remaining design and implementation was completed by David Zwiers.



Copyright © 1996-2009 Geotools. All Rights Reserved.