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(java.lang.String namespace, java.lang.String systemId, XmlSchemaCollection parent)
          Create a new schema and record it as a member of a schema collection.
XmlSchema(java.lang.String namespace, XmlSchemaCollection parent)
           
XmlSchema(XmlSchemaCollection parent)
          Deprecated.  
 
Method Summary
 void addType(XmlSchemaType type)
           
 void compile(ValidationEventHandler eh)
           
 boolean equals(java.lang.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, java.util.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, java.util.Stack schemaStack)
           
 XmlSchemaElement getElementByName(java.lang.String name)
          get an element by the name in the local schema
 XmlSchemaForm getElementFormDefault()
           
 XmlSchemaObjectTable getElements()
           
 XmlSchemaDerivationMethod getFinalDefault()
           
 XmlSchemaObjectTable getGroups()
           
 XmlSchemaObjectCollection getIncludes()
           
 java.lang.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()
           
 java.lang.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, java.util.Stack schemaStack)
          Protected method that allows safe (non-recursive schema loading).
 XmlSchemaType getTypeByName(java.lang.String name)
          Search this schema for a type by qname.
 java.lang.String getVersion()
           
 boolean isCompiled()
           
 void setAttributeFormDefault(XmlSchemaForm value)
           
 void setBlockDefault(XmlSchemaDerivationMethod blockDefault)
           
 void setElementFormDefault(XmlSchemaForm elementFormDefault)
           
 void setFinalDefault(XmlSchemaDerivationMethod finalDefault)
           
 void setInputEncoding(java.lang.String encoding)
           
 void setNamespaceContext(NamespacePrefixList namespaceContext)
          Sets the schema elements namespace context.
 void setTargetNamespace(java.lang.String targetNamespace)
           
 java.lang.String toString()
           
 void write(java.io.OutputStream out)
          Serialize the schema into the given output stream
 void write(java.io.OutputStream out, java.util.Map options)
          Serialize the schema into the given output stream
 void write(java.io.Writer writer)
          Serialie the schema to a given writer
 void write(java.io.Writer writer, java.util.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(java.lang.String namespace,
                 java.lang.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(java.lang.String namespace,
                 XmlSchemaCollection parent)
Method Detail

setInputEncoding

public void setInputEncoding(java.lang.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,
                                            java.util.Stack schemaStack)

getAttributeByName

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

getElementByName

public XmlSchemaElement getElementByName(java.lang.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,
                                      java.util.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(java.lang.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 java.lang.String getTargetNamespace()

setTargetNamespace

public void setTargetNamespace(java.lang.String targetNamespace)

getVersion

public java.lang.String getVersion()

compile

public void compile(ValidationEventHandler eh)

write

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

Parameters:
out - - the output stream to write to

write

public void write(java.io.OutputStream out,
                  java.util.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(java.io.Writer writer,
                  java.util.Map options)
Serialie the schema to a given writer

Parameters:
writer - - the writer to write this

write

public void write(java.io.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(java.lang.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 java.lang.String getInputEncoding()

toString

public java.lang.String toString()
Overrides:
toString in class XmlSchemaAnnotated


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