net.sf.jaxme.xs.impl
Class XSSchemaImpl

java.lang.Object
  extended bynet.sf.jaxme.xs.impl.XSSchemaImpl
All Implemented Interfaces:
XSObject, XSSchema
Direct Known Subclasses:
JAXBSchemaImpl

public class XSSchemaImpl
extends java.lang.Object
implements XSSchema

Implementation of an XML Schema, as defined by the XSSchema interface.

Author:
Jochen Wiedmann

Constructor Summary
XSSchemaImpl(XSContext pContext, XsESchema pSchema)
           
 
Method Summary
 void add(XSAnnotation pAnnotation)
          Adds a new annotation to the schema.
 void add(XSAttribute pAttribute)
          Adds a new attribute to the schema.
 void add(XSAttributeGroup pGroup)
          Adds a new attribute group to the schema.
 void add(XSElement pElement)
          Adds a new element to the schema.
 void add(XSGroup pGroup)
          Adds a new group to the schema.
 void add(XSNotation pNotation)
          Adds a new notation to the schema.
 void add(XSType pType)
          Adds a new type to the schema.
protected  void addChild(java.lang.Object pChild)
          Adds a new child to the array returned by getChilds().
 XSAnnotation[] getAnnotations()
          Returns the array of annotations.
 XSAttribute getAttribute(XsQName pQName)
          Returns the attribute with the given name.
 XSAttributeGroup getAttributeGroup(XsQName pName)
          Returns the attribute group with the given name.
 XSAttributeGroup[] getAttributeGroups()
          Returns the array of global attribute groups.
 XSAttribute[] getAttributes()
          Returns the array of global attributes.
 XSType[] getBuiltinTypes()
          Returns the array of builtin types.
 java.lang.Object[] getChilds()
          Returns all the schema annotations, types, groups, attribute groups, elements, and attributes, in the order of declaration.
 XSContext getContext()
          Returns the schemas context.
 XSElement getElement(XsQName pName)
          Returns the element with the given name.
 XSElement[] getElements()
          Returns the array of global elements.
 XSGroup getGroup(XsQName pName)
          Returns the group with the given name.
 XSGroup[] getGroups()
          Returns the array of global groups.
 org.xml.sax.Locator getLocator()
          Returns the objects location.
 XSObject getParentObject()
          Returns either of the following: If the object is the schema itself, returns null.
 XSType getType(XsQName pName)
          Returns the type with the given name.
 XSType[] getTypes()
          Returns the array of global types.
protected  XsESchema getXsESchema()
           
 XSObjectFactory getXSObjectFactory()
          Returns the schemas object factory.
 XSSchema getXSSchema()
          Returns the objects schema.
 boolean isTopLevelObject()
          Returns whether the object is a top-level object.
protected  boolean isValidated()
           
 void redefine(XSAttributeGroup pGroup)
          Redefines an existing attribute group in the schema.
 void redefine(XSGroup pGroup)
          Redefines an existing group in the schema.
 void redefine(XSType pType)
          Redefines an existing type in the schema.
protected  void replace(java.lang.Object pOldChild, java.lang.Object pNewChild)
          Replaces the existing child pOldChild with the replacement object pNewChild.
 void validate()
          Validates the objects internal state.
protected  void validate(java.lang.Object pChild)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSSchemaImpl

public XSSchemaImpl(XSContext pContext,
                    XsESchema pSchema)
Method Detail

getContext

public XSContext getContext()
Description copied from interface: XSSchema

Returns the schemas context.

Specified by:
getContext in interface XSSchema

isTopLevelObject

public boolean isTopLevelObject()
Description copied from interface: XSObject

Returns whether the object is a top-level object. This is the case for the XsESchema itself and for all its childs only.

Specified by:
isTopLevelObject in interface XSObject

getParentObject

public XSObject getParentObject()
Description copied from interface: XSObject

Returns either of the following:

Specified by:
getParentObject in interface XSObject

getXSObjectFactory

public XSObjectFactory getXSObjectFactory()
Description copied from interface: XSSchema

Returns the schemas object factory.

Specified by:
getXSObjectFactory in interface XSSchema

getLocator

public org.xml.sax.Locator getLocator()
Description copied from interface: XSObject

Returns the objects location.

Specified by:
getLocator in interface XSObject

getXSSchema

public XSSchema getXSSchema()
Description copied from interface: XSObject

Returns the objects schema.

Specified by:
getXSSchema in interface XSObject

getXsESchema

protected XsESchema getXsESchema()

addChild

protected void addChild(java.lang.Object pChild)

Adds a new child to the array returned by getChilds().


replace

protected void replace(java.lang.Object pOldChild,
                       java.lang.Object pNewChild)

Replaces the existing child pOldChild with the replacement object pNewChild. This method is used from within the various redefine() methods.


getAnnotations

public XSAnnotation[] getAnnotations()
Description copied from interface: XSSchema

Returns the array of annotations.

Specified by:
getAnnotations in interface XSSchema

getTypes

public XSType[] getTypes()
Description copied from interface: XSSchema

Returns the array of global types. This includes simple and complex types. The builtin types are not included.

Specified by:
getTypes in interface XSSchema
See Also:
XSSchema.getType(XsQName)

getBuiltinTypes

public XSType[] getBuiltinTypes()
Description copied from interface: XSSchema

Returns the array of builtin types. This includes simple and complex types.

Specified by:
getBuiltinTypes in interface XSSchema
See Also:
XSSchema.getTypes()

getType

public XSType getType(XsQName pName)
Description copied from interface: XSSchema

Returns the type with the given name. This may be a builtin type or a type defined by the schema.

Specified by:
getType in interface XSSchema

getGroups

public XSGroup[] getGroups()
Description copied from interface: XSSchema

Returns the array of global groups.

Specified by:
getGroups in interface XSSchema

getGroup

public XSGroup getGroup(XsQName pName)
Description copied from interface: XSSchema

Returns the group with the given name.

Specified by:
getGroup in interface XSSchema

getAttributeGroups

public XSAttributeGroup[] getAttributeGroups()
Description copied from interface: XSSchema

Returns the array of global attribute groups.

Specified by:
getAttributeGroups in interface XSSchema

getAttributeGroup

public XSAttributeGroup getAttributeGroup(XsQName pName)
Description copied from interface: XSSchema

Returns the attribute group with the given name.

Specified by:
getAttributeGroup in interface XSSchema

getElements

public XSElement[] getElements()
Description copied from interface: XSSchema

Returns the array of global elements.

Specified by:
getElements in interface XSSchema

getElement

public XSElement getElement(XsQName pName)
Description copied from interface: XSSchema

Returns the element with the given name.

Specified by:
getElement in interface XSSchema

getAttributes

public XSAttribute[] getAttributes()
Description copied from interface: XSSchema

Returns the array of global attributes.

Specified by:
getAttributes in interface XSSchema

getAttribute

public XSAttribute getAttribute(XsQName pQName)
Description copied from interface: XSSchema

Returns the attribute with the given name.

Specified by:
getAttribute in interface XSSchema

add

public void add(XSAnnotation pAnnotation)
Description copied from interface: XSSchema

Adds a new annotation to the schema.

Specified by:
add in interface XSSchema

add

public void add(XSType pType)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new type to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

redefine

public void redefine(XSType pType)
              throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Redefines an existing type in the schema.

Specified by:
redefine in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSGroup pGroup)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new group to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

redefine

public void redefine(XSGroup pGroup)
              throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Redefines an existing group in the schema.

Specified by:
redefine in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSAttributeGroup pGroup)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new attribute group to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

redefine

public void redefine(XSAttributeGroup pGroup)
              throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Redefines an existing attribute group in the schema.

Specified by:
redefine in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSAttribute pAttribute)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new attribute to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSElement pElement)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new element to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSNotation pNotation)
Description copied from interface: XSSchema

Adds a new notation to the schema.

Specified by:
add in interface XSSchema

getChilds

public java.lang.Object[] getChilds()
Description copied from interface: XSSchema

Returns all the schema annotations, types, groups, attribute groups, elements, and attributes, in the order of declaration.

Specified by:
getChilds in interface XSSchema

validate

protected void validate(java.lang.Object pChild)
                 throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

isValidated

protected boolean isValidated()

validate

public void validate()
              throws org.xml.sax.SAXException
Description copied from interface: XSObject

Validates the objects internal state.

Specified by:
validate in interface XSObject
Throws:
org.xml.sax.SAXException