deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.commons.xml.schema
Class XSModelAnalyzer

java.lang.Object
  extended by org.deegree.commons.xml.schema.XSModelAnalyzer
Direct Known Subclasses:
GMLSchemaAnalyzer

public class XSModelAnalyzer
extends Object

Provides convenient methods to retrieve "relevant" element and type declarations of an XML schema infoset.

This functionality is very handy for extracting higher-level structures defined using XML schema, such as GML feature types.

Version:
$Revision:$, $Date:$
Author:
Markus Schneider , last edited by: $Author:$
See Also:
GMLSchemaAnalyzer

Field Summary
protected  org.apache.xerces.xs.XSModel xmlSchema
          The XML schema infoset.
 
Constructor Summary
XSModelAnalyzer(String... schemaUrls)
          Creates a new XSModelAnalyzer instance that reads the schema documents from the given URLs.
XSModelAnalyzer(org.apache.xerces.xs.XSModel xmlSchema)
          Creates a new XSModelAnalyzer for the given (Xerces) XML schema infoset.
 
Method Summary
 org.apache.xerces.xs.XSNamespaceItemList getNamespaces()
           
 List<org.apache.xerces.xs.XSElementDeclaration> getSubstitutions(QName elementName, String namespace, boolean transitive, boolean onlyConcrete)
          Returns the declarations of all elements that are substitutable for a given element name.
 List<org.apache.xerces.xs.XSElementDeclaration> getSubstitutions(org.apache.xerces.xs.XSElementDeclaration elementDecl, String namespace, boolean transitive, boolean onlyConcrete)
          Returns the declarations of all elements that are substitutable for a given element declaration.
 org.apache.xerces.xs.XSModel getXSModel()
          Returns the XML schema infoset (represented as a Xerces XSModel).
static org.apache.xerces.xs.XSModel loadModel(String... schemaUrls)
          Creates a Xerces XSModel from the schemas at the given URLs, using the RedirectingEntityResolver, so OGC schemas URLs are redirected to a local copy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xmlSchema

protected final org.apache.xerces.xs.XSModel xmlSchema
The XML schema infoset.

Constructor Detail

XSModelAnalyzer

public XSModelAnalyzer(org.apache.xerces.xs.XSModel xmlSchema)
Creates a new XSModelAnalyzer for the given (Xerces) XML schema infoset.

Parameters:
xmlSchema - schema infoset, must not be null

XSModelAnalyzer

public XSModelAnalyzer(String... schemaUrls)
                throws ClassCastException,
                       ClassNotFoundException,
                       InstantiationException,
                       IllegalAccessException
Creates a new XSModelAnalyzer instance that reads the schema documents from the given URLs.

Parameters:
schemaUrls - locations of the schema documents, must not be null and contain at least one entry
Throws:
ClassCastException
ClassNotFoundException
InstantiationException
IllegalAccessException
Method Detail

getNamespaces

public org.apache.xerces.xs.XSNamespaceItemList getNamespaces()

getXSModel

public org.apache.xerces.xs.XSModel getXSModel()
Returns the XML schema infoset (represented as a Xerces XSModel).

Returns:
the XML schema infoset

getSubstitutions

public List<org.apache.xerces.xs.XSElementDeclaration> getSubstitutions(org.apache.xerces.xs.XSElementDeclaration elementDecl,
                                                                        String namespace,
                                                                        boolean transitive,
                                                                        boolean onlyConcrete)
Returns the declarations of all elements that are substitutable for a given element declaration.

Parameters:
elementDecl - element declaration, must not be null
namespace - only element declarations in this namespace are returned, set to null for all namespaces
transitive - if true, also substitutions for substitutions (and so one) are included
onlyConcrete - if true, only concrete (non-abstract) declarations are returned
Returns:
the declarations of all substitution elements in the requested namespace

getSubstitutions

public List<org.apache.xerces.xs.XSElementDeclaration> getSubstitutions(QName elementName,
                                                                        String namespace,
                                                                        boolean transitive,
                                                                        boolean onlyConcrete)
Returns the declarations of all elements that are substitutable for a given element name.

Parameters:
elementName - qualified name of the element, must not be null
namespace - only element declarations in this namespace are returned, set to null for all namespaces
transitive - if true, also substitutions for substitutions (and so one) are included
onlyConcrete - if true, only concrete (non-abstract) declarations are returned
Returns:
the declarations of all substitution elements in the requested namespace

loadModel

public static org.apache.xerces.xs.XSModel loadModel(String... schemaUrls)
                                              throws ClassCastException,
                                                     ClassNotFoundException,
                                                     InstantiationException,
                                                     IllegalAccessException
Creates a Xerces XSModel from the schemas at the given URLs, using the RedirectingEntityResolver, so OGC schemas URLs are redirected to a local copy.

Parameters:
schemaUrls - locations of the schema documents, must not be null and contain at least one entry
Returns:
the XML schema infoset, never null
Throws:
ClassCastException
ClassNotFoundException
InstantiationException
IllegalAccessException

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>