Class XMLSchemaModelUtils

java.lang.Object
org.opengis.cite.iso19136.util.XMLSchemaModelUtils

public class XMLSchemaModelUtils extends Object
Provides utility methods for accessing components of XML Schema models.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<org.apache.xerces.xs.XSParticle>
    getAllElementParticles(org.apache.xerces.xs.XSParticle particle)
    Returns all constituent particles corresponding to element declarations.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getAllElementsInParticle(org.apache.xerces.xs.XSParticle particle)
    Returns all element declarations contained in the given particle schema component.
    static Set<String>
    getApplicationNamespaces(org.apache.xerces.xs.XSModel model)
    Returns a list of application-specific namespace names declared in a schema.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getCoverageDeclarations(org.apache.xerces.xs.XSModel model)
    Returns a collection of coverage elements in the application namespace(s).
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getCRSDeclarations(org.apache.xerces.xs.XSModel model)
    Returns a collection of CRS declarations in the application namespace(s).
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getDefinitionDeclarations(org.apache.xerces.xs.XSModel model)
    Returns a collection of definition elements declared in the application namespace(s), including dictionaries.
    static Set<org.apache.xerces.xs.XSTypeDefinition>
    getDerivedTypeDefinitions(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSTypeDefinition baseType, short derivationMethod)
    Returns the set of type definitions that are derived from the given base type using the specified method.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getElementDeclarationsByType(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSTypeDefinition baseType)
    Returns a list of element declarations (globally and locally scoped) whose type definition either matches the given base type or derives from it by extension.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getElementsByAffiliation(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSElementDeclaration head)
    Returns a collection of element declarations that may substitute (directly or indirectly) for the specified element.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getExplicitGeometryProperties(org.apache.xerces.xs.XSModel model)
    Returns a list of geometry properties explicitly declared in an application namespace.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getFeatureDeclarations(org.apache.xerces.xs.XSModel model)
    Returns a collection of concrete feature element declarations in the application namespace(s).
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getGeometryDeclarations(org.apache.xerces.xs.XSModel model)
    Returns a collection of concrete geometry element declarations in the application namespace(s).
    static Set<org.apache.xerces.xs.XSComplexTypeDefinition>
    getGlobalComplexTypeDefinitions(org.apache.xerces.xs.XSModel model)
    Returns a collection of top-level complex types defined in all application namespaces.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getGlobalElementsByType(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSTypeDefinition typeDef)
    Returns a list of globally-scoped (top-level) element declarations whose type definition either matches the given type or derives from it by extension.
    static void
    getHeadElements(Set<org.apache.xerces.xs.XSElementDeclaration> headElems, org.apache.xerces.xs.XSElementDeclaration propValue)
    Identifies the set of (head) elements for which the given element can substitute.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getImplicitProperties(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSElementDeclaration headElem)
    Returns a list of implicitly defined GML properties whose expected value is substitutable for the specified head element.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getLocalElementsByType(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSTypeDefinition typeDef, SchemaComponentFilter typeFilter)
    Returns a list of locally-scoped element declarations whose type definition either matches the given type or derives from it by extension.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getObservationDeclarations(org.apache.xerces.xs.XSModel model)
    Returns a collection of observation elements declared in the application namespace(s).
    static QName
    getQName(org.apache.xerces.xs.XSObject xsObject)
    Gets the name of the given XML Schema component.
    static Set<org.apache.xerces.xs.XSComplexTypeDefinition>
    getReferencedComplexTypeDefinitions(org.apache.xerces.xs.XSModel model)
    Returns a collection of complex type definitions referenced by global elements declared in all application namespaces.
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getTimeObjectDeclarations(org.apache.xerces.xs.XSModel model)
    Returns a collection of temporal element declarations in the application namespace(s).
    static List<org.apache.xerces.xs.XSElementDeclaration>
    getTopologyDeclarations(org.apache.xerces.xs.XSModel model)
    Returns a collection of topology element declarations in the application namespace(s).
    static boolean
    propertyHasValueDomain(org.apache.xerces.xs.XSComplexTypeDefinition typeDef, org.apache.xerces.xs.XSElementDeclaration headElem)
    Determines whether or not a given complex property type has a specified value domain.
    (package private) static void
    removeGmlElementsFromList(List<org.apache.xerces.xs.XSElementDeclaration> elemDecls)
    Removes elements declared in the standard GML namespace ( "http://www.opengis.net/gml/3.2"), leaving only those residing in an application namespace.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XMLSchemaModelUtils

      public XMLSchemaModelUtils()
  • Method Details

    • getFeatureDeclarations

      public static List<org.apache.xerces.xs.XSElementDeclaration> getFeatureDeclarations(org.apache.xerces.xs.XSModel model)
      Returns a collection of concrete feature element declarations in the application namespace(s). These elements may substitute for gml:AbstractFeature.
      Parameters:
      model - An XSModel object representing the application schema.
      Returns:
      A List containing all (global) element declarations belonging to the substitution group having gml:AbstractFeature as its head.
      See Also:
      • "ISO 19136:2007, 21.3.3"
    • getGeometryDeclarations

      public static List<org.apache.xerces.xs.XSElementDeclaration> getGeometryDeclarations(org.apache.xerces.xs.XSModel model)
      Returns a collection of concrete geometry element declarations in the application namespace(s). These elements may substitute for gml:AbstractGeometry.
      Parameters:
      model - An XSModel object representing the application schema.
      Returns:
      A List containing all (global) element declarations belonging to the substitution group having gml:AbstractGeometry as its head.
      See Also:
      • "ISO 19136:2007, 21.4.2.1"
    • getExplicitGeometryProperties

      public static List<org.apache.xerces.xs.XSElementDeclaration> getExplicitGeometryProperties(org.apache.xerces.xs.XSModel model)
      Returns a list of geometry properties explicitly declared in an application namespace. Such geometry properties are identified as indicated below.
      • Elements declared to have a type that derives by restriction from gml:GeometryPropertyType
      • Elements declared to have a type that derives by restriction from gml:GeometryArrayPropertyType
      • Elements declared to use a predefined GML geometry property type (see cl. 9.5, Table 4)
      Parameters:
      model - An XSModel object incorporating application schema components.
      Returns:
      A list of element declarations that correspond to explicit geometry properties. The list is empty if none are found.
    • getImplicitProperties

      public static List<org.apache.xerces.xs.XSElementDeclaration> getImplicitProperties(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSElementDeclaration headElem)
      Returns a list of implicitly defined GML properties whose expected value is substitutable for the specified head element. Such properties have a content model that is consistent with gml:AssociationRoleType but is not explicitly derived from any predefined GML property type.
      Parameters:
      model - An XSModel object incorporating application schema components.
      headElem - The head of the substitution group to which the property value belongs.
      Returns:
      A list of element declarations that correspond to implicit GML properties having the specified value domain. The list is empty if none are found.
    • propertyHasValueDomain

      public static boolean propertyHasValueDomain(org.apache.xerces.xs.XSComplexTypeDefinition typeDef, org.apache.xerces.xs.XSElementDeclaration headElem)
      Determines whether or not a given complex property type has a specified value domain.
      Parameters:
      typeDef - A complex type definition that resembles a GML property type.
      headElem - The head element indicating the type of the property value(s).
      Returns:
      true if the property value is substitutable for the head element; false otherwise.
    • getHeadElements

      public static void getHeadElements(Set<org.apache.xerces.xs.XSElementDeclaration> headElems, org.apache.xerces.xs.XSElementDeclaration propValue)
      Identifies the set of (head) elements for which the given element can substitute.
      Parameters:
      headElems - The set to be populated with head element declarations. The set will always contain the given element declaration, which could serve as a head element itself.
      propValue - A global element declaration that is presumably affiliated with some substitution group.
    • getTopologyDeclarations

      public static List<org.apache.xerces.xs.XSElementDeclaration> getTopologyDeclarations(org.apache.xerces.xs.XSModel model)
      Returns a collection of topology element declarations in the application namespace(s). These elements may substitute for gml:AbstractTopology.
      Parameters:
      model - An XSModel object representing the application schema.
      Returns:
      A List containing all (global) element declarations belonging to the substitution group having gml:AbstractTopology as its head.
      See Also:
      • "ISO 19136:2007, 21.5.2.1"
    • getTimeObjectDeclarations

      public static List<org.apache.xerces.xs.XSElementDeclaration> getTimeObjectDeclarations(org.apache.xerces.xs.XSModel model)
      Returns a collection of temporal element declarations in the application namespace(s). These elements may substitute for gml:AbstractTimeObject.
      Parameters:
      model - An XSModel object representing the application schema.
      Returns:
      A List containing all (global) element declarations belonging to the substitution group having gml:AbstractTimeObject as its head.
      See Also:
      • "ISO 19136:2007, 21.6.2.1"
    • getCRSDeclarations

      public static List<org.apache.xerces.xs.XSElementDeclaration> getCRSDeclarations(org.apache.xerces.xs.XSModel model)
      Returns a collection of CRS declarations in the application namespace(s). These elements (which may substitute for gml:AbstractCRS) are typically declared whenever a standard CRS type must be extended or restricted.
      Parameters:
      model - An XSModel object representing the application schema.
      Returns:
      A List containing all (global) element declarations belonging to the substitution group having gml:AbstractCRS as its head.
      See Also:
      • "ISO 19136:2007, 21.6.2.1"
    • getCoverageDeclarations

      public static List<org.apache.xerces.xs.XSElementDeclaration> getCoverageDeclarations(org.apache.xerces.xs.XSModel model)
      Returns a collection of coverage elements in the application namespace(s). These elements may substitute for gml:AbstractCoverage. Note that in the latest GML schema gml:AbstractContinuousCoverage, unlike gml:AbstractDiscreteCoverage, cannot substitute for gml:AbstractCoverage.
      Parameters:
      model - An XSModel object representing the application schema.
      Returns:
      A List containing all (global) element declarations belonging to the substitution group having gml:AbstractCoverage as its head.
      See Also:
      • "ISO 19136:2007, 21.8.3"
    • getObservationDeclarations

      public static List<org.apache.xerces.xs.XSElementDeclaration> getObservationDeclarations(org.apache.xerces.xs.XSModel model)
      Returns a collection of observation elements declared in the application namespace(s). These elements may substitute for gml:Observation.
      Parameters:
      model - An XSModel object representing the application schema.
      Returns:
      A List containing all (global) element declarations belonging to the substitution group having gml:Observation as its head.
      See Also:
      • "ISO 19136:2007, 21.9.3"
    • getDefinitionDeclarations

      public static List<org.apache.xerces.xs.XSElementDeclaration> getDefinitionDeclarations(org.apache.xerces.xs.XSModel model)
      Returns a collection of definition elements declared in the application namespace(s), including dictionaries. These elements may substitute for gml:Definition.
      Parameters:
      model - An XSModel object representing the application schema.
      Returns:
      A List containing all (global) element declarations belonging to the substitution group having gml:Definition as its head.
      See Also:
      • "ISO 19136:2007, 21.10.3-4"
    • getElementsByAffiliation

      public static List<org.apache.xerces.xs.XSElementDeclaration> getElementsByAffiliation(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSElementDeclaration head)
      Returns a collection of element declarations that may substitute (directly or indirectly) for the specified element.
      Parameters:
      model - An XSModel object incorporating application schema components.
      head - The head of the substitution group.
      Returns:
      A List containing all element declarations having the designated substitution group affiliation. The list may be empty; it will certainly be empty if the head element is null.
    • getGlobalElementsByType

      public static List<org.apache.xerces.xs.XSElementDeclaration> getGlobalElementsByType(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSTypeDefinition typeDef)
      Returns a list of globally-scoped (top-level) element declarations whose type definition either matches the given type or derives from it by extension.
      Parameters:
      model - An XSModel object incorporating application schema components.
      typeDef - A simple or complex type defining the content model of the desired elements. It may be an ancestor type.
      Returns:
      A List containing globally-scoped element declarations in an application namespace. The list is empty if no matching declarations are found.
    • getLocalElementsByType

      public static List<org.apache.xerces.xs.XSElementDeclaration> getLocalElementsByType(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSTypeDefinition typeDef, SchemaComponentFilter typeFilter)
      Returns a list of locally-scoped element declarations whose type definition either matches the given type or derives from it by extension. The scope of these declarations is some complex type definition that may be accessed using the getEnclosingCTDefinition method. The type definitions to be examined may be restricted using a component filter.
      Parameters:
      model - An XSModel object incorporating application schema components.
      typeDef - A simple or complex type defining the content model of the desired elements. It may be an ancestor type.
      typeFilter - A schema component filter that determines which type definitions will be examined; if null, all complex types defined in application namespaces will be inspected.
      Returns:
      A List containing locally-scoped element declarations in an application namespace. The list is empty if no matching declarations are found.
    • getAllElementsInParticle

      public static List<org.apache.xerces.xs.XSElementDeclaration> getAllElementsInParticle(org.apache.xerces.xs.XSParticle particle)
      Returns all element declarations contained in the given particle schema component. The {term} property of a particle is one of a model group, a wildcard, or an element declaration. Note that a model group (denoted by the "all", "choice", or "sequence" compositor) can contain other model groups.
      Parameters:
      particle - An XSParticle representing a particle component.
      Returns:
      A List of element declarations contained directly or indirectly in the particle; the components are listed in document order.
    • getAllElementParticles

      public static List<org.apache.xerces.xs.XSParticle> getAllElementParticles(org.apache.xerces.xs.XSParticle particle)
      Returns all constituent particles corresponding to element declarations. The {term} property of a particle is one of a model group, a wildcard, or an element declaration.
      Parameters:
      particle - A particle schema component to inspect.
      Returns:
      A List containing particles that have an element declaration as its term.
    • getReferencedComplexTypeDefinitions

      public static Set<org.apache.xerces.xs.XSComplexTypeDefinition> getReferencedComplexTypeDefinitions(org.apache.xerces.xs.XSModel model)
      Returns a collection of complex type definitions referenced by global elements declared in all application namespaces. The resulting set may include anonymous types.
      Parameters:
      model - An XSModel object.
      Returns:
      A Set containing XSComplexTypeDefinition components.
    • getGlobalComplexTypeDefinitions

      public static Set<org.apache.xerces.xs.XSComplexTypeDefinition> getGlobalComplexTypeDefinitions(org.apache.xerces.xs.XSModel model)
      Returns a collection of top-level complex types defined in all application namespaces.
      Parameters:
      model - An XSModel object.
      Returns:
      A Set containing XSComplexTypeDefinition components.
    • getApplicationNamespaces

      public static Set<String> getApplicationNamespaces(org.apache.xerces.xs.XSModel model)
      Returns a list of application-specific namespace names declared in a schema. These are absolute URIs with non-standard authority components or scheme names.
      Parameters:
      model - An XSModel object incorporating application schema components.
      Returns:
      A Set of Strings denoting the target namespace(s) used by the application schema.
    • getDerivedTypeDefinitions

      public static Set<org.apache.xerces.xs.XSTypeDefinition> getDerivedTypeDefinitions(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSTypeDefinition baseType, short derivationMethod)
      Returns the set of type definitions that are derived from the given base type using the specified method.
      Parameters:
      model - An XSModel object containing schema components.
      baseType - The base (ancestor) type.
      derivationMethod - A bit combination representing a subset of { DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST }.
      Returns:
      A Set containing zero or more simple or complex type definitions (XSTypeDefinition objects).
    • getElementDeclarationsByType

      public static List<org.apache.xerces.xs.XSElementDeclaration> getElementDeclarationsByType(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSTypeDefinition baseType)
      Returns a list of element declarations (globally and locally scoped) whose type definition either matches the given base type or derives from it by extension. For local element declarations the enclosing (complex) type is restricted to being a feature type.
      Parameters:
      model - An XSModel object incorporating application schema components from one or more namespaces.
      baseType - A simple or complex type defining the content model of the desired elements. It may be an ancestor type.
      Returns:
      A list of element declarations. The list is empty if no matching element declarations are found.
    • getQName

      public static QName getQName(org.apache.xerces.xs.XSObject xsObject)
      Gets the name of the given XML Schema component.
      Parameters:
      xsObject - An XSObject representing a schema component.
      Returns:
      A QName indicating the qualified name of the schema component. If it is anonymous its localName is an empty string.
    • removeGmlElementsFromList

      static void removeGmlElementsFromList(List<org.apache.xerces.xs.XSElementDeclaration> elemDecls)
      Removes elements declared in the standard GML namespace ( "http://www.opengis.net/gml/3.2"), leaving only those residing in an application namespace.
      Parameters:
      elemDecls - A List of element declarations.