| java.lang.Object org.geotools.xml.Schemas
Schemas | public class Schemas (Code) | | Utility class for performing various opreations.
author: Justin Deoliveira, The Open Planning Project |
Inner Class :static class SchemaLocatorAdapterFactory extends AdapterFactoryImpl | |
Inner Class :static class SchemaLocatorAdapter extends AdapterImpl implements XSDSchemaLocator | |
Inner Class :static class SchemaLocationResolverAdapterFactory extends AdapterFactoryImpl | |
Inner Class :static class SchemaLocationResolverAdapter extends AdapterImpl implements XSDSchemaLocationResolver | |
Method Summary | |
public static List | findSchemaLocationResolvers(Configuration configuration) Finds all
XSDSchemaLocationResolver 's used by the configuration.
Parameters: configuration - The parser configuration. | final public static SchemaIndex | findSchemas(Configuration configuration) Finds all the XSDSchemas used by the
Configuration configuration
by looking at the configuration's schema locator and its dependencies. | final public static XSDAttributeDeclaration | getAttributeDeclaration(XSDElementDeclaration element, QName qName) Returns an attribute declaration that is contained in the type of another
element declaration. | final public static List | getAttributeDeclarations(XSDElementDeclaration element) Returns a list of all attribute declarations declared in the type (or
any base type) of the specified element.
This method is just a shortcut for
Schemas.getAttributeDeclarations(XSDTypeDefinition) getAttributeDeclarations(element.getType()
Parameters: element - The element. | final public static List | getAttributeDeclarations(XSDTypeDefinition type) Returns a list of all attribute declarations declared in the type (or
any base type) of the specified element.
Parameters: element - The element. | final public static XSDTypeDefinition | getBaseTypeDefinition(XSDTypeDefinition type, QName parentTypeName) Returns the base type defintion of 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 .
Parameters: type - The type. Parameters: parentTypeName - The name of the base type to return. | final public static XSDElementDeclaration | getChildElementDeclaration(XSDElementDeclaration parent, QName qName) Returns an element declaration that is contained in the type of another
element declaration. | final public static List | getChildElementDeclarations(XSDElementDeclaration element) Returns a list of all child element declarations of the specified
element, no order is guaranteed.
Parameters: element - The parent element. | final public static List | getChildElementDeclarations(XSDTypeDefinition type) Returns a list of all child element declarations of the specified
type, no order is guaranteed.
Parameters: type - The type. | final public static List | getChildElementDeclarations(XSDElementDeclaration element, boolean includeParents) Returns a list of all child element declarations of the specified
element.
The includeParents flag controls if this method should
returns those elements defined on parent types.
Parameters: element - The parent element. Parameters: includeParents - Flag indicating if parent types should be processed. | final public static List | getChildElementDeclarations(XSDTypeDefinition type, boolean includeParents) Returns a list of all child element declarations of the specified
type, no order is guaranteed. | final public static XSDParticle | getChildElementParticle(XSDTypeDefinition type, String name, boolean includeParents) Returns the particle for an element declaration that is part of a type.
Parameters: type - The type definition. Parameters: name - The naem of the child element declaration. Parameters: includeParents - Flag to control wether parent types are included. | final public 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. | public static List | getComponentInstancesOfType(PicoContainer container, Class clazz) Obtains all instances of a particular class from a container by navigating
up the container hierachy.
Parameters: container - The container. Parameters: clazz - The class. | final public 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.
Parameters: element - The element. | public static XSDElementDeclaration | getElementDeclaration(XSDSchema schema, QName name) Searches schema for an element which matches name . | final public static List | getImports(XSDSchema schema) Returns a flat list of imports from the specified schema.
The method recurses into imported schemas. | final public static List | getIncludes(XSDSchema schema) Returns a flat list of includes from the specified schema.
The method recurses into included schemas. | final public static int | getMaxOccurs(XSDComplexTypeDefinition type, XSDElementDeclaration element) Returns the minimum number of occurences of an element within a complex
type.
Parameters: type - The type definition containg the declaration element Parameters: element - The declaration of the element. | final public static int | getMinOccurs(XSDComplexTypeDefinition type, XSDElementDeclaration element) Returns the minimum number of occurences of an element within a complex
type.
Parameters: type - The type definition containg the declaration element Parameters: element - The declaration of the element. | public static String | getTargetPrefix(XSDSchema schema) Returns the namespace prefix mapped to the targetNamespace of the schema.
Parameters: schema - The schema in question. | final public static boolean | nameMatches(XSDNamedComponent component, QName qName) Method for comparing the name of a schema component to a qualified name.
The component name and the qualified name match if both the namespaces
match, and the local parts match. | final public static XSDSchema | parse(String location) Parses a schema at the specified location.
Parameters: location - A uri pointing to the location of the schema. | final public static XSDSchema | parse(String location, XSDSchemaLocator[] locators, XSDSchemaLocationResolver[] resolvers) Parses a schema at the specified location.
Parameters: location - A uri pointing to the location of the schema. Parameters: locators - An array of schema locator objects to be used whenparsing imports/includes of the main schema. Parameters: resolvers - An array of schema location resolvers used to overrideschema locations encountered in an instance document or an importedschema. | final public static XSDSchema | parse(String location, List locators, List resolvers) | public static void | unregisterComponent(PicoContainer container, Object key) Unregisters a component in the container and all parent containers. |
findSchemaLocationResolvers | public static List findSchemaLocationResolvers(Configuration configuration)(Code) | | Finds all
XSDSchemaLocationResolver 's used by the configuration.
Parameters: configuration - The parser configuration. A list of location resolvers, empty if none found. |
findSchemas | final public static SchemaIndex findSchemas(Configuration configuration)(Code) | | Finds all the XSDSchemas used by the
Configuration configuration
by looking at the configuration's schema locator and its dependencies.
Parameters: configuration - the Configuration for which to find all itsrelated schemas a SchemaIndex holding the schemas related to configuration |
getAttributeDeclaration | final public static XSDAttributeDeclaration getAttributeDeclaration(XSDElementDeclaration element, QName qName)(Code) | | Returns an attribute declaration that is contained in the type of another
element declaration.
Parameters: element - The containing element declaration. Parameters: qName - The qualified name of the contained attribute The contained attribute declaration, or false if containment isnot satisfied. |
getAttributeDeclarations | final public static List getAttributeDeclarations(XSDElementDeclaration element)(Code) | | Returns a list of all attribute declarations declared in the type (or
any base type) of the specified element.
This method is just a shortcut for
Schemas.getAttributeDeclarations(XSDTypeDefinition) getAttributeDeclarations(element.getType()
Parameters: element - The element. A list of @link XSDAttributeDeclaration objects, one for eachattribute of the element. |
getAttributeDeclarations | final public static List getAttributeDeclarations(XSDTypeDefinition type)(Code) | | Returns a list of all attribute declarations declared in the type (or
any base type) of the specified element.
Parameters: element - The element. A list of @link XSDAttributeDeclaration objects, one for eachattribute of the element. |
getBaseTypeDefinition | final public static XSDTypeDefinition getBaseTypeDefinition(XSDTypeDefinition type, QName parentTypeName)(Code) | | Returns the base type defintion of 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 .
Parameters: type - The type. Parameters: parentTypeName - The name of the base type to return. The base type, or null if it could not be found. |
getChildElementDeclaration | final public static XSDElementDeclaration getChildElementDeclaration(XSDElementDeclaration parent, QName qName)(Code) | | Returns an element declaration that is contained in the type of another
element declaration. The following strategy is used to locate the child
element declaration.
- The immediate children of the specified element are examined, if a
match is found, it is returned.
If 1. does not match, global elements that derive from the
immediate children are examined.
Parameters: parent - the containing element declaration Parameters: qName - the qualified name of the contained element The contained element declaration, or false if containment isnot satisfied. |
getChildElementDeclarations | final public static List getChildElementDeclarations(XSDElementDeclaration element)(Code) | | Returns a list of all child element declarations of the specified
element, no order is guaranteed.
Parameters: element - The parent element. A list of @link XSDElementDeclaration objects, one for eachchild element.Schemas.getChildElementDeclarations(XSDTypeDefinition) |
getChildElementDeclarations | final public static List getChildElementDeclarations(XSDTypeDefinition type)(Code) | | Returns a list of all child element declarations of the specified
type, no order is guaranteed.
Parameters: type - The type. A list of @link XSDElementDeclaration objects, one for eachchild element. |
getChildElementDeclarations | final public static List getChildElementDeclarations(XSDElementDeclaration element, boolean includeParents)(Code) | | Returns a list of all child element declarations of the specified
element.
The includeParents flag controls if this method should
returns those elements defined on parent types.
Parameters: element - The parent element. Parameters: includeParents - Flag indicating if parent types should be processed. A list of @link XSDElementDeclaration objects, one for eachchild element.Schemas.getChildElementDeclarations(XSDTypeDefinition,boolean) |
getChildElementDeclarations | final public static List getChildElementDeclarations(XSDTypeDefinition type, boolean includeParents)(Code) | | Returns a list of all child element declarations of the specified
type, no order is guaranteed.
The includeParents flag controls if this method should
returns those elements defined on parent types.
Parameters: type - The type Parameters: includeParents - flag indicating if parent types should be processed A list of @link XSDElementDeclaration objects, one for eachchild element. |
getChildElementParticle | final public static XSDParticle getChildElementParticle(XSDTypeDefinition type, String name, boolean includeParents)(Code) | | Returns the particle for an element declaration that is part of a type.
Parameters: type - The type definition. Parameters: name - The naem of the child element declaration. Parameters: includeParents - Flag to control wether parent types are included. The particle representing the element declaration, or null if it could not be found. |
getChildElementParticles | final public static List getChildElementParticles(XSDTypeDefinition type, boolean includeParents)(Code) | | Returns a list of all child element particles that corresponde to element declarations of
the specified type, no order is guaranteed.
The includeParents flag controls if this method should
returns those elements defined on parent types.
Parameters: type - THe type. Parameters: includeParents - flag indicating if parent types should be processed A list of XSDParticle. |
getComponentInstancesOfType | public static List getComponentInstancesOfType(PicoContainer container, Class clazz)(Code) | | Obtains all instances of a particular class from a container by navigating
up the container hierachy.
Parameters: container - The container. Parameters: clazz - The class. A list of all instances of clazz , or the empty list if none found. |
getDerivedElementDeclarations | final public static List getDerivedElementDeclarations(XSDElementDeclaration element)(Code) | | Returns a list of all top level elements that are of a type derived
from the type of the specified element.
Parameters: element - The element. All elements which are of a type derived from the type of thespecified element. |
getElementDeclaration | public static XSDElementDeclaration getElementDeclaration(XSDSchema schema, QName name)(Code) | | Searches schema for an element which matches name .
Parameters: schema - The schema Parameters: name - The element to search for The element declaration, or null if it could not be found. |
getImports | final public static List getImports(XSDSchema schema)(Code) | | Returns a flat list of imports from the specified 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.
Parameters: schema - The top-level schema. A list containing objects of type XSDImport. |
getIncludes | final public static List getIncludes(XSDSchema schema)(Code) | | Returns a flat list of includes from the specified 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
Parameters: schema - The top-level schema. A list containing objects of type XSDInclude. |
getMaxOccurs | final public static int getMaxOccurs(XSDComplexTypeDefinition type, XSDElementDeclaration element)(Code) | | Returns the minimum number of occurences of an element within a complex
type.
Parameters: type - The type definition containg the declaration element Parameters: element - The declaration of the element. The minimum number of occurences. throws: IllegalArgumentException - If the element declaration cannot belocaated withing the type definition. |
getMinOccurs | final public static int getMinOccurs(XSDComplexTypeDefinition type, XSDElementDeclaration element)(Code) | | Returns the minimum number of occurences of an element within a complex
type.
Parameters: type - The type definition containg the declaration element Parameters: element - The declaration of the element. The minimum number of occurences. throws: IllegalArgumentException - If the element declaration cannot belocaated withing the type definition. |
getTargetPrefix | public static String getTargetPrefix(XSDSchema schema)(Code) | | Returns the namespace prefix mapped to the targetNamespace of the schema.
Parameters: schema - The schema in question. The namesapce prefix, or null if not found. |
nameMatches | final public static boolean nameMatches(XSDNamedComponent component, QName qName)(Code) | | Method for comparing the name of a schema component to a qualified name.
The component name and the qualified name match if both the namespaces
match, and the local parts match. Prefixes are ignored. Two strings will
match if one of the following conditions hold.
- Both strings are null.
- Both strings are the empty string.
- One string is null, and the other is the empty string.
- Both strings are non-null and non-empty and equals() return true.
Parameters: component - The component in question. Parameters: qName - The qualifined name. |
parse | final public static XSDSchema parse(String location) throws IOException(Code) | | Parses a schema at the specified location.
Parameters: location - A uri pointing to the location of the schema. The parsed schema, or null if the schema could not be parsed. throws: IOException - In the event of a schema parsing error. |
parse | final public static XSDSchema parse(String location, XSDSchemaLocator[] locators, XSDSchemaLocationResolver[] resolvers) throws IOException(Code) | | Parses a schema at the specified location.
Parameters: location - A uri pointing to the location of the schema. Parameters: locators - An array of schema locator objects to be used whenparsing imports/includes of the main schema. Parameters: resolvers - An array of schema location resolvers used to overrideschema locations encountered in an instance document or an importedschema. The parsed schema, or null if the schema could not be parsed. throws: IOException - In the event of a schema parsing error. |
unregisterComponent | public static void unregisterComponent(PicoContainer container, Object key)(Code) | | Unregisters a component in the container and all parent containers.
Parameters: container - The container. Parameters: key - The key of the component. |
|
|