deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.framework.xml.schema
Class XSDocument

java.lang.Object
  extended by org.deegree.framework.xml.XMLFragment
      extended by org.deegree.framework.xml.schema.XSDocument
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
GMLSchemaDocument

public class XSDocument
extends XMLFragment

Parser for XML schema documents.

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Markus Schneider , Anup Deshmukh , last edited by: $Author: mschneider $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.deegree.framework.xml.XMLFragment
DEFAULT_URL, nsContext, XLNNS
 
Constructor Summary
XSDocument()
           
 
Method Summary
 ComplexTypeDeclaration[] extractComplexTypeDeclarations()
          Extracts all global (top-level) complex type declarations from the underlying schema document.
 ElementDeclaration[] extractElementDeclarations()
          Extracts all global (top-level) element declarations from the underlying schema document.
 SimpleTypeDeclaration[] extractSimpleTypeDeclarations()
          Extracts all global (top-level) simple type declarations from the underlying schema document.
 Element getComplexTypeDeclaration(String name)
          Returns the root element of the complex type declaration for the given name.
protected  String getFullName(String localName)
          Prepends the prefix of the RootElement to the given local name.
 URI getTargetNamespace()
          Returns the target namespace of the underlying schema document.
protected  ComplexTypeDeclaration parseComplexTypeDeclaration(Element element)
          Parses the given Element as an 'xs:complexType' declaration.
protected  ElementDeclaration parseElementDeclaration(Element element)
          Parses the given Element as an 'xs:element' declaration.
protected  SimpleTypeDeclaration parseSimpleTypeDeclaration(Element element)
          Parses the given Element as an 'xs:simpleType' declaration.
 XMLSchema parseXMLSchema()
          Returns the class representation of the underlying schema document.
 
Methods inherited from class org.deegree.framework.xml.XMLFragment
getAsPrettyString, getAsString, getAttachedSchemas, getQualifiedName, getRootElement, getSystemId, hasSchema, load, load, load, parseQualifiedName, parseSimpleLink, prettyPrint, prettyPrint, resolve, setRootElement, setSystemId, setSystemId, toString, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XSDocument

public XSDocument()
Method Detail

parseXMLSchema

public XMLSchema parseXMLSchema()
                         throws XMLParsingException,
                                XMLSchemaException
Returns the class representation of the underlying schema document.

Returns:
class representation of the underlying schema document
Throws:
XMLParsingException
XMLSchemaException

getTargetNamespace

public URI getTargetNamespace()
                       throws XMLParsingException
Returns the target namespace of the underlying schema document.

Returns:
target namespace of the underlying schema document
Throws:
XMLParsingException

extractSimpleTypeDeclarations

public SimpleTypeDeclaration[] extractSimpleTypeDeclarations()
                                                      throws XMLParsingException
Extracts all global (top-level) simple type declarations from the underlying schema document.

Returns:
all global (top-level) simple type declarations
Throws:
XMLParsingException - if the document is not a valid XML Schema document or does not match the limitations of this class

extractComplexTypeDeclarations

public ComplexTypeDeclaration[] extractComplexTypeDeclarations()
                                                        throws XMLParsingException
Extracts all global (top-level) complex type declarations from the underlying schema document.

Returns:
all global (top-level) complex type declarations
Throws:
XMLParsingException - if the document is not a valid XML Schema document or does not match the limitations of this class

extractElementDeclarations

public ElementDeclaration[] extractElementDeclarations()
                                                throws XMLParsingException
Extracts all global (top-level) element declarations from the underlying schema document.

Returns:
all global (top-level) element declarations
Throws:
XMLParsingException - if the document is not a valid XML Schema document or does not match the limitations of this class

getComplexTypeDeclaration

public Element getComplexTypeDeclaration(String name)
Returns the root element of the complex type declaration for the given name.

Parameters:
name - the name of the complex type declaration to look up (w/o namespace)
Returns:
the root element of the complex type declaration or null, if the requested complex type is not declared

parseElementDeclaration

protected ElementDeclaration parseElementDeclaration(Element element)
                                              throws XMLParsingException
Parses the given Element as an 'xs:element' declaration.

Parameters:
element - 'xs:element' declaration to be parsed
Returns:
object representation of the declaration
Throws:
XMLParsingException - if the document is not a valid XML Schema document or does not match the limitations of this class

parseSimpleTypeDeclaration

protected SimpleTypeDeclaration parseSimpleTypeDeclaration(Element element)
                                                    throws XMLParsingException
Parses the given Element as an 'xs:simpleType' declaration.

The following limitations apply:

Parameters:
element - 'xs:simpleType' declaration to be parsed
Returns:
object representation of the declaration
Throws:
XMLParsingException - if the document is not a valid XML Schema document or does not match the limitations of this class

parseComplexTypeDeclaration

protected ComplexTypeDeclaration parseComplexTypeDeclaration(Element element)
                                                      throws XMLParsingException
Parses the given Element as an 'xs:complexType' declaration.

Parameters:
element - 'xs:complexType' declaration to be parsed
Returns:
object representation of the declaration
Throws:
XMLParsingException - if the document is not a valid XML Schema document or does not match the limitations of this class

getFullName

protected String getFullName(String localName)
Prepends the prefix of the RootElement to the given local name.

If the prefix of the RootElement is empty, "xs:" is prepended.

Parameters:
localName - to this the prefix will be prepended
Returns:
prefix + localName

deegree 2.3 (2010/04/09 10:10 build-4-official)

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