de.ispsoft.jaxme.generator
Class XsdSchemaReader

java.lang.Object
  extended byde.ispsoft.jaxme.generator.ConfigurableImpl
      extended byde.ispsoft.jaxme.generator.SchemaReaderImpl
          extended byde.ispsoft.jaxme.generator.XsdSchemaReader
All Implemented Interfaces:
Configurable, SchemaReader
Direct Known Subclasses:
XsdJdbcSchemaReader

public class XsdSchemaReader
extends SchemaReaderImpl

A SchemaReader for XML Schemas.

Author:
Jochen Wiedmann

Field Summary
static java.lang.String JAXME_SCHEMA_URI
          The JaxMe standard namespace
static java.lang.String XML_SCHEMA_URI
          The supported XML Schema namespace
 
Constructor Summary
XsdSchemaReader()
          Creates new XsdSchemaReader
 
Method Summary
 void addDecorators(SchemaAnnotationOwner pParent, SchemaElement pSchemaElement, ParserData pParserData, org.w3c.dom.Element pElement)
          Adds decorators to a generated element or attribute.
 void addElementDecoratorFactory(ElementDecoratorFactory pFactory, Schema pSchema, ParserData pParserData, org.w3c.dom.Element pSchemaNode)
          Adds a new ElementDecoratorFactory to the list of such factories.
 void clearElementDecoratorFactories()
          Clears the ElementDecoratorFactory list.
static java.lang.String findDefaultNamespaceURI(org.w3c.dom.Element pElement)
           
protected  SchemaElement findElement(java.lang.String pElementName, org.w3c.dom.Element pElement, Schema pSchema, ParserData pParserData)
           
static java.lang.String findNamespaceURI(java.lang.String pValue, org.w3c.dom.Element pElement)
           
protected  SchemaType findType(java.lang.String pTypeName, org.w3c.dom.Element pElement, ParserData pParserData, boolean pAcceptDefault)
           
protected  java.lang.String getDefaultExtendsClassName()
           
 void getDefaults(ParserData pParserData, org.w3c.dom.Element pNode)
          Reads the jaxme:defaults declaration.
 ElementDecoratorFactory[] getElementDecoratorFactories()
          Returns the array of registered ElementDecoratorFactory instances.
 org.xml.sax.InputSource getInputSource(java.lang.String pBaseSystemId, java.lang.String pSystemId)
          Creates a new InputSource, based on the given URLs.
protected  Schema getSchema()
          Returns the schema being parsed.
protected  org.w3c.dom.Element getSchemaNode()
          Returns the "schema" Node being parsed.
 ParserData newParserData(java.lang.String pTargetNamespace)
          Returns a ParserData instance.
protected  SchemaComplexElement newSchemaComplexElement(SchemaAnnotationOwner pParent)
           
 Schema parse(org.xml.sax.InputSource pSource)
          Called for parsing a schema definition stored in the given InputStream.
 Schema parse(org.w3c.dom.Node pDocument, java.lang.String pSystemId)
          Called for parsing a schema definition from the given DOM tree.
protected  void parseAppInfoDefaultNode(ParserData pParserData, org.w3c.dom.Element pNode)
           
protected  void parseAppInfoNode(SchemaElement pSchemaElement, ParserData pParserData, org.w3c.dom.Element pNode)
           
 void parseAttributeAttributes(SchemaAnnotationOwner pParent, SchemaAttribute pAttribute, org.w3c.dom.Element pElement, ParserData pParserData)
          Parses a single attribute definition.
 void parseAttributeList(SchemaComplexElement pComplexElement, org.w3c.dom.Element pElement, ParserData pParserData)
          Called for parsing the complexType's attribute list.
 void parseComplexElement(SchemaComplexElement pComplexElement, org.w3c.dom.Element pElement, ParserData pParserData)
          Called for parsing the complexType declaration.
 SchemaElement parseElement(SchemaAnnotationOwner pParent, org.w3c.dom.Element pElement, ParserData pParserData, boolean pGlobal)
          Called for parsing a single schema element from the given DOM tree.
 void parseElementAttributes(SchemaAnnotationOwner pParent, SchemaElement pSchemaElement, org.w3c.dom.Element pElement, ParserData pParserData, boolean pGlobal)
          Called for parsing the standard attributes from an element or attribute definition.
protected  void parseElementList(SchemaComplexElement pComplexElement, org.w3c.dom.Element pElement, ParserData pParserData)
           
 void parseSimpleType(SchemaAbstractSimpleElement pSimpleElement, org.w3c.dom.Element pElement, ParserData pParserData)
          Called for parsing the simpleType declaration.
protected  void setSchema(Schema pSchema)
          Sets the schema being created.
protected  void setSchemaNode(org.w3c.dom.Element pSchemaNode)
          Sets the "schema" Node being parsed.
 
Methods inherited from class de.ispsoft.jaxme.generator.SchemaReaderImpl
getGenerator, parse, setGenerator
 
Methods inherited from class de.ispsoft.jaxme.generator.ConfigurableImpl
getOption, getOptions, getOptionValue, setOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.ispsoft.jaxme.generator.Configurable
getOption, getOptions, getOptionValue, setOption
 

Field Detail

XML_SCHEMA_URI

public static final java.lang.String XML_SCHEMA_URI

The supported XML Schema namespace

See Also:
Constant Field Values

JAXME_SCHEMA_URI

public static final java.lang.String JAXME_SCHEMA_URI

The JaxMe standard namespace

See Also:
Constant Field Values
Constructor Detail

XsdSchemaReader

public XsdSchemaReader()
Creates new XsdSchemaReader

Method Detail

getDefaultExtendsClassName

protected java.lang.String getDefaultExtendsClassName()

newParserData

public ParserData newParserData(java.lang.String pTargetNamespace)

Returns a ParserData instance.


parseSimpleType

public void parseSimpleType(SchemaAbstractSimpleElement pSimpleElement,
                            org.w3c.dom.Element pElement,
                            ParserData pParserData)
                     throws SchemaException

Called for parsing the simpleType declaration.

Throws:
SchemaException

addDecorators

public void addDecorators(SchemaAnnotationOwner pParent,
                          SchemaElement pSchemaElement,
                          ParserData pParserData,
                          org.w3c.dom.Element pElement)
                   throws SchemaException

Adds decorators to a generated element or attribute.

Throws:
SchemaException

parseAttributeAttributes

public void parseAttributeAttributes(SchemaAnnotationOwner pParent,
                                     SchemaAttribute pAttribute,
                                     org.w3c.dom.Element pElement,
                                     ParserData pParserData)
                              throws java.lang.Exception

Parses a single attribute definition.

Throws:
java.lang.Exception

parseAttributeList

public void parseAttributeList(SchemaComplexElement pComplexElement,
                               org.w3c.dom.Element pElement,
                               ParserData pParserData)
                        throws java.lang.Exception

Called for parsing the complexType's attribute list.

Throws:
java.lang.Exception

parseElementList

protected void parseElementList(SchemaComplexElement pComplexElement,
                                org.w3c.dom.Element pElement,
                                ParserData pParserData)
                         throws java.lang.Exception
Throws:
java.lang.Exception

parseComplexElement

public void parseComplexElement(SchemaComplexElement pComplexElement,
                                org.w3c.dom.Element pElement,
                                ParserData pParserData)
                         throws java.lang.Exception

Called for parsing the complexType declaration.

Throws:
java.lang.Exception

findType

protected SchemaType findType(java.lang.String pTypeName,
                              org.w3c.dom.Element pElement,
                              ParserData pParserData,
                              boolean pAcceptDefault)
                       throws SchemaException
Throws:
SchemaException

findElement

protected SchemaElement findElement(java.lang.String pElementName,
                                    org.w3c.dom.Element pElement,
                                    Schema pSchema,
                                    ParserData pParserData)
                             throws SchemaException
Throws:
SchemaException

parseElementAttributes

public void parseElementAttributes(SchemaAnnotationOwner pParent,
                                   SchemaElement pSchemaElement,
                                   org.w3c.dom.Element pElement,
                                   ParserData pParserData,
                                   boolean pGlobal)
                            throws java.lang.Exception

Called for parsing the standard attributes from an element or attribute definition.

Throws:
java.lang.Exception

parseElement

public SchemaElement parseElement(SchemaAnnotationOwner pParent,
                                  org.w3c.dom.Element pElement,
                                  ParserData pParserData,
                                  boolean pGlobal)
                           throws java.lang.Exception

Called for parsing a single schema element from the given DOM tree.

Throws:
java.lang.Exception

getDefaults

public void getDefaults(ParserData pParserData,
                        org.w3c.dom.Element pNode)
                 throws SchemaException

Reads the jaxme:defaults declaration.

Throws:
SchemaException

parseAppInfoDefaultNode

protected void parseAppInfoDefaultNode(ParserData pParserData,
                                       org.w3c.dom.Element pNode)
                                throws SchemaException
Throws:
SchemaException

parseAppInfoNode

protected void parseAppInfoNode(SchemaElement pSchemaElement,
                                ParserData pParserData,
                                org.w3c.dom.Element pNode)
                         throws java.lang.Exception
Throws:
java.lang.Exception

setSchemaNode

protected void setSchemaNode(org.w3c.dom.Element pSchemaNode)

Sets the "schema" Node being parsed.


getSchemaNode

protected org.w3c.dom.Element getSchemaNode()

Returns the "schema" Node being parsed.


setSchema

protected void setSchema(Schema pSchema)

Sets the schema being created.


getSchema

protected Schema getSchema()

Returns the schema being parsed.


getInputSource

public org.xml.sax.InputSource getInputSource(java.lang.String pBaseSystemId,
                                              java.lang.String pSystemId)
                                       throws java.io.IOException

Creates a new InputSource, based on the given URLs.

Throws:
java.io.IOException

parse

public Schema parse(org.w3c.dom.Node pDocument,
                    java.lang.String pSystemId)
             throws java.lang.Exception

Called for parsing a schema definition from the given DOM tree.

Throws:
java.lang.Exception

parse

public Schema parse(org.xml.sax.InputSource pSource)
             throws java.lang.Exception

Called for parsing a schema definition stored in the given InputStream.

Specified by:
parse in interface SchemaReader
Specified by:
parse in class SchemaReaderImpl
Throws:
java.lang.Exception

newSchemaComplexElement

protected SchemaComplexElement newSchemaComplexElement(SchemaAnnotationOwner pParent)

findDefaultNamespaceURI

public static java.lang.String findDefaultNamespaceURI(org.w3c.dom.Element pElement)

findNamespaceURI

public static java.lang.String findNamespaceURI(java.lang.String pValue,
                                                org.w3c.dom.Element pElement)

addElementDecoratorFactory

public void addElementDecoratorFactory(ElementDecoratorFactory pFactory,
                                       Schema pSchema,
                                       ParserData pParserData,
                                       org.w3c.dom.Element pSchemaNode)
                                throws SchemaException

Adds a new ElementDecoratorFactory to the list of such factories.

Throws:
SchemaException

clearElementDecoratorFactories

public void clearElementDecoratorFactories()

Clears the ElementDecoratorFactory list.


getElementDecoratorFactories

public ElementDecoratorFactory[] getElementDecoratorFactories()

Returns the array of registered ElementDecoratorFactory instances.