public class Schemas extends Object
Constructor and Description |
---|
Schemas() |
Modifier and Type | Method and Description |
---|---|
static void |
dispose(XSDSchema schema)
Remove all references to a schema It is important to call this method for every dynamic
schema created that is not needed anymore, because references in the static schema's will
otherwise keep it alive forever
|
static List |
findSchemaLocationResolvers(Configuration configuration)
Finds all
XSDSchemaLocationResolver 's used by the configuration. |
static SchemaIndex |
findSchemas(Configuration configuration)
Finds all the XSDSchemas used by the
configuration by looking at the
configuration's schema locator and its dependencies. |
static List |
getAnyElementParticles(XSDTypeDefinition type)
Returns a list of all xs:any element particles that correspond to element declarations of the
specified type.
|
static XSDAttributeDeclaration |
getAttributeDeclaration(XSDElementDeclaration element,
QName qName)
Returns an attribute declaration that is contained in the type of another element
declaration.
|
static List |
getAttributeDeclarations(XSDElementDeclaration element)
Returns a list of all attribute declarations declared in the type (or any base type) of the
specified element.
|
static List |
getAttributeDeclarations(XSDTypeDefinition type)
Returns a list of all attribute declarations declared in the type (or any base type) of the
specified element.
|
static List |
getAttributeDeclarations(XSDTypeDefinition type,
boolean includeParents)
Returns a list of all attribute declarations declared in the type (and optionally any base
type) of the specified element.
|
static XSDTypeDefinition |
getBaseTypeDefinition(XSDTypeDefinition type,
QName parentTypeName)
Returns the base type defintion of
type named parentTypeName |
static XSDElementDeclaration |
getChildElementDeclaration(XSDElementDeclaration parent,
QName qName)
Returns an element declaration that is contained in the type of another element declaration.
|
static List |
getChildElementDeclarations(XSDElementDeclaration element)
Deprecated.
|
static List |
getChildElementDeclarations(XSDElementDeclaration element,
boolean includeParents)
Deprecated.
|
static List |
getChildElementDeclarations(XSDTypeDefinition type)
Returns a list of all child element declarations of the specified type, no order is
guaranteed.
|
static List |
getChildElementDeclarations(XSDTypeDefinition type,
boolean includeParents)
Returns a list of all child element declarations of the specified type, no order is
guaranteed.
|
static XSDParticle |
getChildElementParticle(XSDTypeDefinition type,
String name,
boolean includeParents)
Returns the particle for an element declaration that is part of a type.
|
static List |
getChildElementParticles(XSDTypeDefinition type,
boolean includeParents)
Returns a list of all child element particles that corresponde to element declarations of the
specified type, no order is guaranteed.
|
static List<ComponentAdapter> |
getComponentAdaptersOfType(PicoContainer container,
Class clazz)
Obtains all component adapters of a particular class from a container by navigating up the
container hierarchy.
|
static List |
getComponentInstancesOfType(PicoContainer container,
Class clazz)
Obtains all instances of a particular class from a container by navigating up the container
hierachy.
|
static List |
getDerivedElementDeclarations(XSDElementDeclaration element)
Returns a list of all top level elements that are of a type derived from the type of the
specified element.
|
static XSDElementDeclaration |
getElementDeclaration(XSDSchema schema,
QName name)
Searches
schema for an element which matches name . |
static List |
getImports(XSDSchema schema)
Returns a flat list of imports from the specified schema.
|
static List |
getIncludes(XSDSchema schema)
Returns a flat list of includes from the specified schema.
|
static int |
getMaxOccurs(XSDComplexTypeDefinition type,
XSDElementDeclaration element)
Returns the minimum number of occurences of an element within a complex type.
|
static int |
getMinOccurs(XSDComplexTypeDefinition type,
XSDElementDeclaration element)
Returns the minimum number of occurences of an element within a complex type.
|
static QName |
getParticleName(XSDParticle particle)
Returns the name of the element represented by the particle as a QName.
|
static String |
getTargetPrefix(XSDSchema schema)
Returns the namespace prefix mapped to the targetNamespace of the schema.
|
static XSDImport |
importSchema(XSDSchema schema,
XSDSchema importee)
Imports one schema into another.
|
static boolean |
isBaseType(XSDElementDeclaration e1,
XSDElementDeclaration e2)
Determines if the type of an element is a sub-type of another element.
|
static boolean |
nameMatches(XSDNamedComponent component,
QName qName)
Method for comparing the name of a schema component to a qualified name.
|
static XSDSchema |
parse(String location)
Parses a schema at the specified location.
|
static XSDSchema |
parse(String location,
List locators,
List resolvers)
Parses a schema at the specified location.
|
static XSDSchema |
parse(String location,
List locators,
List resolvers,
List<URIHandler> uriHandlers)
Parses a schema at the specified location.
|
static XSDSchema |
parse(String location,
ResourceSet resourceSet) |
static XSDSchema |
parse(String location,
XSDSchemaLocator[] locators,
XSDSchemaLocationResolver[] resolvers)
Deprecated.
|
static void |
unregisterComponent(PicoContainer container,
Object key)
Unregisters a component in the container and all parent containers.
|
static List |
validateImportsIncludes(String location) |
static List |
validateImportsIncludes(String location,
List locators,
List resolvers) |
static List |
validateImportsIncludes(String location,
XSDSchemaLocator[] locators,
XSDSchemaLocationResolver[] resolvers) |
public static final SchemaIndex findSchemas(Configuration configuration)
configuration
by looking at the
configuration's schema locator and its dependencies.configuration
- the Configuration
for which to find all its related schemasSchemaIndex
holding the schemas related to configuration
public static List findSchemaLocationResolvers(Configuration configuration)
XSDSchemaLocationResolver
's used by the configuration.configuration
- The parser configuration.public static final XSDSchema parse(String location) throws IOException
location
- A uri pointing to the location of the schema.IOException
- In the event of a schema parsing error.public static final XSDSchema parse(String location, XSDSchemaLocator[] locators, XSDSchemaLocationResolver[] resolvers) throws IOException
parse(String, List, List)
location
- A uri pointing to the location of the schema.locators
- An array of schema locator objects to be used when parsing imports/includes
of the main schema.resolvers
- An array of schema location resolvers used to override schema locations
encountered in an instance document or an imported schema.IOException
- In the event of a schema parsing error.public static final XSDSchema parse(String location, List locators, List resolvers) throws IOException
location
- A uri pointing to the location of the schema.locators
- A list of schema locator objects to be used when parsing imports/includes of
the main schema.resolvers
- A list of schema location resolvers used to override schema locations
encountered in an instance document or an imported schema.IOException
- In the event of a schema parsing error.public static final XSDSchema parse(String location, List locators, List resolvers, List<URIHandler> uriHandlers) throws IOException
location
- A uri pointing to the location of the schema.locators
- A list of schema locator objects to be used when parsing imports/includes of
the main schema.resolvers
- A list of schema location resolvers used to override schema locations
encountered in an instance document or an imported schema.uriHandlers
- A list of uri handlers to inject into the parsing chain, to handle
externally referenced resources, like external schemas, etc...IOException
- In the event of a schema parsing error.public static final XSDSchema parse(String location, ResourceSet resourceSet) throws IOException
IOException
public static final XSDImport importSchema(XSDSchema schema, XSDSchema importee) throws IOException
schema
- The schema being imported into.importee
- The schema being imported.IOException
public static final void dispose(XSDSchema schema)
schema
- to be flushedpublic static final List validateImportsIncludes(String location) throws IOException
IOException
public static final List validateImportsIncludes(String location, XSDSchemaLocator[] locators, XSDSchemaLocationResolver[] resolvers) throws IOException
IOException
public static final List validateImportsIncludes(String location, List locators, List resolvers) throws IOException
IOException
public static final List getChildElementDeclarations(XSDElementDeclaration element)
getChildElementDeclarations(XSDTypeDefinition)
element
- The parent element.public static final List getChildElementDeclarations(XSDTypeDefinition type)
type
- The type.public static final List getChildElementDeclarations(XSDElementDeclaration element, boolean includeParents)
getChildElementDeclarations(XSDTypeDefinition, boolean)
The includeParents
flag controls if this method should returns those elements
defined on parent types.
element
- The parent element.includeParents
- Flag indicating if parent types should be processed.public static final XSDParticle getChildElementParticle(XSDTypeDefinition type, String name, boolean includeParents)
type
- The type definition.name
- The naem of the child element declaration.includeParents
- Flag to control wether parent types are included.null
if it could
not be found.public static final List getChildElementParticles(XSDTypeDefinition type, boolean includeParents)
The includeParents
flag controls if this method should returns those elements
defined on parent types.
type
- THe type.includeParents
- flag indicating if parent types should be processedXSDParticle
.public static final List getAnyElementParticles(XSDTypeDefinition type)
type
- The type.XSDParticle
.public static final List getChildElementDeclarations(XSDTypeDefinition type, boolean includeParents)
The includeParents
flag controls if this method should returns those elements
defined on parent types.
type
- The typeincludeParents
- flag indicating if parent types should be processedpublic static final XSDTypeDefinition getBaseTypeDefinition(XSDTypeDefinition type, QName parentTypeName)
type
named parentTypeName.
This method will handle the case in which the parentTypeName == type.getTypeName()
.
If no such parent type is found this method will return null
.
type
- The type.parentTypeName
- The name of the base type to return.public static final boolean isBaseType(XSDElementDeclaration e1, XSDElementDeclaration e2)
e1
- The element.e2
- The element to be tested as a base type.public static final int getMinOccurs(XSDComplexTypeDefinition type, XSDElementDeclaration element)
type
- The type definition containg the declaration element
element
- The declaration of the element.IllegalArgumentException
- If the element declaration cannot be locaated withing the
type definition.public static final int getMaxOccurs(XSDComplexTypeDefinition type, XSDElementDeclaration element)
type
- The type definition containg the declaration element
element
- The declaration of the element.IllegalArgumentException
- If the element declaration cannot be locaated withing the
type definition.public static final XSDElementDeclaration getChildElementDeclaration(XSDElementDeclaration parent, QName qName)
parent
- the containing element declarationqName
- the qualified name of the contained elementpublic static final List getDerivedElementDeclarations(XSDElementDeclaration element)
element
- The element.public static final List getAttributeDeclarations(XSDElementDeclaration element)
This method is just a shortcut for getAttributeDeclarations(element.getType()
element
- The element.public static final List getAttributeDeclarations(XSDTypeDefinition type)
element
- The element.public static final List getAttributeDeclarations(XSDTypeDefinition type, boolean includeParents)
element
- The element.includeParents
- Wether to include parent types.public static final XSDAttributeDeclaration getAttributeDeclaration(XSDElementDeclaration element, QName qName)
element
- The containing element declaration.qName
- The qualified name of the contained attributepublic static final List getImports(XSDSchema schema)
The method recurses into imported schemas. The list returned is filtered so that duplicate includes are removed. Two includes are considered equal if they have the same target namespace.
schema
- The top-level schema.XSDImport
.public static final List getIncludes(XSDSchema schema)
The method recurses into included schemas. The list returned is filtered so that duplicate includes are removed. Two includes are considered equal if they have the same uri location
schema
- The top-level schema.XSDInclude
.public static XSDElementDeclaration getElementDeclaration(XSDSchema schema, QName name)
schema
for an element which matches name
.schema
- The schemaname
- The element to search forpublic static final boolean nameMatches(XSDNamedComponent component, QName qName)
component
- The component in question.qName
- The qualifined name.public static String getTargetPrefix(XSDSchema schema)
schema
- The schema in question.null
if not found.public static List getComponentInstancesOfType(PicoContainer container, Class clazz)
container
- The container.clazz
- The class.clazz
, or the empty list if none found.public static List<ComponentAdapter> getComponentAdaptersOfType(PicoContainer container, Class clazz)
container
- The container.clazz
- The class.clazz
, or the empty list
if none found.public static void unregisterComponent(PicoContainer container, Object key)
container
- The container.key
- The key of the component.public static QName getParticleName(XSDParticle particle)
Copyright © 1996–2019 Geotools. All rights reserved.