org.apache.ws.commons.schema
Class XmlSchema

java.lang.Object
  extended by org.apache.ws.commons.schema.XmlSchemaObject
      extended by org.apache.ws.commons.schema.XmlSchemaAnnotated
          extended by org.apache.ws.commons.schema.XmlSchema
All Implemented Interfaces:
NamespaceContextOwner

public class XmlSchema
extends XmlSchemaAnnotated
implements NamespaceContextOwner

Contains the definition of a schema. All XML Schema definition language (XSD) elements are children of the schema element. Represents the World Wide Web Consortium (W3C) schema element


Field Summary
 
Fields inherited from class org.apache.ws.commons.schema.XmlSchemaAnnotated
unhandledAttributes
 
Constructor Summary
XmlSchema()
          Create a schema that is not a member of a collection.
XmlSchema(String namespace, String systemId, XmlSchemaCollection parent)
          Create a new schema and record it as a member of a schema collection.
XmlSchema(String namespace, XmlSchemaCollection parent)
           
XmlSchema(XmlSchemaCollection parent)
          Deprecated.  
 
Method Summary
 void addType(XmlSchemaType type)
           
 void compile(ValidationEventHandler eh)
           
 boolean equals(Object what)
          Override the equals(Object) method with equivalence checking that is specific to this class.
 org.w3c.dom.Document[] getAllSchemas()
           
 XmlSchemaAttribute getAttributeByName(javax.xml.namespace.QName name)
          Look for a global attribute by its QName.
protected  XmlSchemaAttribute getAttributeByName(javax.xml.namespace.QName name, boolean deep, Stack schemaStack)
           
 XmlSchemaForm getAttributeFormDefault()
           
 XmlSchemaObjectTable getAttributeGroups()
           
 XmlSchemaObjectTable getAttributes()
           
 XmlSchemaDerivationMethod getBlockDefault()
           
 XmlSchemaElement getElementByName(javax.xml.namespace.QName name)
          Look for a element by its qname.
protected  XmlSchemaElement getElementByName(javax.xml.namespace.QName name, boolean deep, Stack schemaStack)
           
 XmlSchemaElement getElementByName(String name)
          get an element by the name in the local schema
 XmlSchemaForm getElementFormDefault()
           
 XmlSchemaObjectTable getElements()
           
 XmlSchemaDerivationMethod getFinalDefault()
           
 XmlSchemaObjectTable getGroups()
           
 XmlSchemaObjectCollection getIncludes()
           
 String getInputEncoding()
           
 XmlSchemaObjectCollection getItems()
           
 NamespacePrefixList getNamespaceContext()
          Returns the objects namespace context.
 XmlSchemaObjectTable getNotations()
           
 org.w3c.dom.Document getSchemaDocument()
          Retrieve a DOM tree for this one schema, independent of any included or related schemas.
 XmlSchemaObjectTable getSchemaTypes()
           
 String getTargetNamespace()
           
 XmlSchemaType getTypeByName(javax.xml.namespace.QName name)
          Search this schema and all the imported/included ones for the given Qname
protected  XmlSchemaType getTypeByName(javax.xml.namespace.QName name, boolean deep, Stack schemaStack)
          Protected method that allows safe (non-recursive schema loading).
 XmlSchemaType getTypeByName(String name)
          Search this schema for a type by qname.
 String getVersion()
           
 boolean isCompiled()
           
 void setAttributeFormDefault(XmlSchemaForm value)
           
 void setBlockDefault(XmlSchemaDerivationMethod blockDefault)
           
 void setElementFormDefault(XmlSchemaForm elementFormDefault)
           
 void setFinalDefault(XmlSchemaDerivationMethod finalDefault)
           
 void setInputEncoding(String encoding)
           
 void setNamespaceContext(NamespacePrefixList namespaceContext)
          Sets the schema elements namespace context.
 void setTargetNamespace(String targetNamespace)
           
 String toString()
           
 void write(OutputStream out)
          Serialize the schema into the given output stream
 void write(OutputStream out, Map options)
          Serialize the schema into the given output stream
 void write(Writer writer)
          Serialie the schema to a given writer
 void write(Writer writer, Map options)
          Serialie the schema to a given writer
 
Methods inherited from class org.apache.ws.commons.schema.XmlSchemaAnnotated
getAnnotation, getId, getUnhandledAttributes, setAnnotation, setId, setUnhandledAttributes
 
Methods inherited from class org.apache.ws.commons.schema.XmlSchemaObject
addMetaInfo, getLineNumber, getLinePosition, getMetaInfoMap, getSourceURI, setLineNumber, setLinePosition, setMetaInfoMap, setSourceURI, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlSchema

public XmlSchema(XmlSchemaCollection parent)
Deprecated. 

Creates new XmlSchema Create a new XmlSchema. The schema is not added to the parent collection, since it has no target namespace when created through this constructor. Call XmlSchema(String, XmlSchemaCollection) instead.

Parameters:
parent - the parent XmlSchemaCollection

XmlSchema

public XmlSchema()
Create a schema that is not a member of a collection.


XmlSchema

public XmlSchema(String namespace,
                 String systemId,
                 XmlSchemaCollection parent)
Create a new schema and record it as a member of a schema collection.

Parameters:
namespace - the target namespace.
systemId - the system ID for the schema.
parent - the parent collection.

XmlSchema

public XmlSchema(String namespace,
                 XmlSchemaCollection parent)
Method Detail

setInputEncoding

public void setInputEncoding(String encoding)

getAttributeFormDefault

public XmlSchemaForm getAttributeFormDefault()

setAttributeFormDefault

public void setAttributeFormDefault(XmlSchemaForm value)

getAttributeGroups

public XmlSchemaObjectTable getAttributeGroups()

getAttributes

public XmlSchemaObjectTable getAttributes()

getBlockDefault

public XmlSchemaDerivationMethod getBlockDefault()

setBlockDefault

public void setBlockDefault(XmlSchemaDerivationMethod blockDefault)

getElementFormDefault

public XmlSchemaForm getElementFormDefault()

setElementFormDefault

public void setElementFormDefault(XmlSchemaForm elementFormDefault)

getElements

public XmlSchemaObjectTable getElements()

getElementByName

protected XmlSchemaElement getElementByName(javax.xml.namespace.QName name,
                                            boolean deep,
                                            Stack schemaStack)

getAttributeByName

protected XmlSchemaAttribute getAttributeByName(javax.xml.namespace.QName name,
                                                boolean deep,
                                                Stack schemaStack)

getElementByName

public XmlSchemaElement getElementByName(String name)
get an element by the name in the local schema

Parameters:
name -
Returns:
the element.

getElementByName

public XmlSchemaElement getElementByName(javax.xml.namespace.QName name)
Look for a element by its qname. Searches through all the schemas

Parameters:
name -
Returns:
the element.

getAttributeByName

public XmlSchemaAttribute getAttributeByName(javax.xml.namespace.QName name)
Look for a global attribute by its QName. Searches through all schemas.

Parameters:
name -
Returns:
the attribute.

getTypeByName

protected XmlSchemaType getTypeByName(javax.xml.namespace.QName name,
                                      boolean deep,
                                      Stack schemaStack)
Protected method that allows safe (non-recursive schema loading). It looks for a type with constraints.

Parameters:
name -
deep -
schemaStack -
Returns:
the type.

getTypeByName

public XmlSchemaType getTypeByName(javax.xml.namespace.QName name)
Search this schema and all the imported/included ones for the given Qname

Parameters:
name -
Returns:
the type.

getTypeByName

public XmlSchemaType getTypeByName(String name)
Search this schema for a type by qname.

Parameters:
name -
Returns:
the type.

getFinalDefault

public XmlSchemaDerivationMethod getFinalDefault()

setFinalDefault

public void setFinalDefault(XmlSchemaDerivationMethod finalDefault)

getGroups

public XmlSchemaObjectTable getGroups()

getIncludes

public XmlSchemaObjectCollection getIncludes()

isCompiled

public boolean isCompiled()

getItems

public XmlSchemaObjectCollection getItems()

getNotations

public XmlSchemaObjectTable getNotations()

getSchemaTypes

public XmlSchemaObjectTable getSchemaTypes()

getTargetNamespace

public String getTargetNamespace()

setTargetNamespace

public void setTargetNamespace(String targetNamespace)

getVersion

public String getVersion()

compile

public void compile(ValidationEventHandler eh)

write

public void write(OutputStream out)
Serialize the schema into the given output stream

Parameters:
out - - the output stream to write to

write

public void write(OutputStream out,
                  Map options)
Serialize the schema into the given output stream

Parameters:
out - - the output stream to write to
options - - a map of options

write

public void write(Writer writer,
                  Map options)
Serialie the schema to a given writer

Parameters:
writer - - the writer to write this

write

public void write(Writer writer)
Serialie the schema to a given writer

Parameters:
writer - - the writer to write this

getAllSchemas

public org.w3c.dom.Document[] getAllSchemas()

addType

public void addType(XmlSchemaType type)

getNamespaceContext

public NamespacePrefixList getNamespaceContext()
Description copied from interface: NamespaceContextOwner
Returns the objects namespace context.

Specified by:
getNamespaceContext in interface NamespaceContextOwner

setNamespaceContext

public void setNamespaceContext(NamespacePrefixList namespaceContext)
Sets the schema elements namespace context. This may be used for schema serialization, until a better mechanism was found.


equals

public boolean equals(Object what)
Override the equals(Object) method with equivalence checking that is specific to this class.

Overrides:
equals in class XmlSchemaObject

getSchemaDocument

public org.w3c.dom.Document getSchemaDocument()
                                       throws XmlSchemaSerializer.XmlSchemaSerializerException
Retrieve a DOM tree for this one schema, independent of any included or related schemas.

Returns:
The DOM document.
Throws:
XmlSchemaSerializer.XmlSchemaSerializerException

getInputEncoding

public String getInputEncoding()

toString

public String toString()
Overrides:
toString in class XmlSchemaAnnotated


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.