public class XmlSchema extends XmlSchemaAnnotated implements NamespaceContextOwner
Constructor and Description |
---|
XmlSchema()
Create a schema that is not a member of a collection and has no target namespace or system ID.
|
XmlSchema(String namespace,
String systemId,
XmlSchemaCollection parent)
Create a new schema with a target namespace and system ID, and record it as a member of a schema
collection.
|
XmlSchema(String namespace,
XmlSchemaCollection parent)
Create a new schema in a collection with a target namespace.
|
Modifier and Type | Method and Description |
---|---|
Document[] |
getAllSchemas()
Return an array of DOM documents consisting of this schema and any schemas that it references.
|
XmlSchemaAttribute |
getAttributeByName(QName name)
Retrieve a global attribute by its QName.
|
protected XmlSchemaAttribute |
getAttributeByName(QName name,
boolean deep,
Stack<XmlSchema> schemaStack) |
XmlSchemaAttribute |
getAttributeByName(String name)
Look for an attribute by its local name.
|
XmlSchemaForm |
getAttributeFormDefault() |
XmlSchemaAttributeGroup |
getAttributeGroupByName(QName name)
Retrieve an attribute group by QName.
|
protected XmlSchemaAttributeGroup |
getAttributeGroupByName(QName name,
boolean deep,
Stack<XmlSchema> schemaStack) |
Map<QName,XmlSchemaAttributeGroup> |
getAttributeGroups()
Return a map containing all the defined attribute groups of this schema.
|
Map<QName,XmlSchemaAttribute> |
getAttributes()
Return a map containing all the defined attributes of this schema.
|
XmlSchemaDerivationMethod |
getBlockDefault()
Return the default block value for this schema.
|
XmlSchemaElement |
getElementByName(QName name)
Look for a element by its QName.
|
protected XmlSchemaElement |
getElementByName(QName name,
boolean deep,
Stack<XmlSchema> schemaStack) |
XmlSchemaElement |
getElementByName(String name)
get an element by its local name.
|
XmlSchemaForm |
getElementFormDefault() |
Map<QName,XmlSchemaElement> |
getElements()
Return a map containing all the defined elements of this schema.
|
List<XmlSchemaExternal> |
getExternals()
Return all of the includes, imports, and redefines for this schema.
|
XmlSchemaDerivationMethod |
getFinalDefault() |
XmlSchemaGroup |
getGroupByName(QName name)
Retrieve a group by QName.
|
protected XmlSchemaGroup |
getGroupByName(QName name,
boolean deep,
Stack<XmlSchema> schemaStack) |
Map<QName,XmlSchemaGroup> |
getGroups()
Return a map containing all the defined groups of this schema.
|
String |
getInputEncoding()
Return the character encoding for this schema.
|
List<XmlSchemaObject> |
getItems()
Return all of the global items in this schema.
If org.apache.ws.commons.schema.protectReadOnlyCollections is 'true', this will return a map that checks at runtime. |
String |
getLogicalTargetNamespace()
Return the logical target namespace.
|
NamespacePrefixList |
getNamespaceContext()
Returns the objects namespace context.
|
XmlSchemaNotation |
getNotationByName(QName name)
Retrieve a notation by QName.
|
protected XmlSchemaNotation |
getNotationByName(QName name,
boolean deep,
Stack<XmlSchema> schemaStack) |
Map<QName,XmlSchemaNotation> |
getNotations()
Return a map containing all the defined notations of this schema.
|
XmlSchemaCollection |
getParent()
Return the parent XmlSchemaCollection.
|
Document |
getSchemaDocument()
Retrieve a DOM tree for this one schema, independent of any included or related schemas.
|
String |
getSchemaNamespacePrefix() |
Map<QName,XmlSchemaType> |
getSchemaTypes()
Return a map containing all the defined types of this schema.
|
String |
getTargetNamespace()
Return the declared target namespace of this schema.
|
XmlSchemaType |
getTypeByName(QName name)
Search this schema, and its peers in its parent collection, for a schema type specified by QName.
|
protected XmlSchemaType |
getTypeByName(QName name,
boolean deep,
Stack<XmlSchema> schemaStack)
Protected method that allows safe (non-recursive schema loading).
|
XmlSchemaType |
getTypeByName(String name)
Retrieve a named type from this schema.
|
String |
getVersion()
Return the declared XML Schema version of this schema.
|
void |
setAttributeFormDefault(XmlSchemaForm value)
Set the default attribute form for this schema.
|
void |
setBlockDefault(XmlSchemaDerivationMethod blockDefault)
Set the default block value for this schema.
|
void |
setElementFormDefault(XmlSchemaForm elementFormDefault)
Set the default element form for this schema.
|
void |
setFinalDefault(XmlSchemaDerivationMethod finalDefault)
Set the default 'final' value for this schema.
|
void |
setInputEncoding(String encoding)
Set the character encoding name for the schema.
|
void |
setNamespaceContext(NamespacePrefixList namespaceContext)
Sets the schema elements namespace context.
|
void |
setSchemaNamespacePrefix(String schemaNamespacePrefix)
Set the namespace prefix corresponding to the target namespace.
|
void |
setTargetNamespace(String targetNamespace)
Set the target namespace for this schema.
|
String |
toString() |
void |
write(OutputStream out)
Serialize the schema as XML to the specified stream using the encoding established with
setInputEncoding(String) . |
void |
write(OutputStream out,
Map<String,String> options)
Serialize the schema as XML to the specified stream using the encoding established with
setInputEncoding(String) . |
void |
write(Writer writer)
Serialize the schema to a
Writer . |
void |
write(Writer writer,
Map<String,String> options)
Serialize the schema to a
Writer . |
getAnnotation, getId, getUnhandledAttributes, setAnnotation, setId, setUnhandledAttributes
addMetaInfo, equals, getLineNumber, getLinePosition, getMetaInfoMap, getSourceURI, hashCode, setLineNumber, setLinePosition, setMetaInfoMap, setSourceURI
public XmlSchema()
public XmlSchema(String namespace, String systemId, XmlSchemaCollection parent)
namespace
- the target namespace.systemId
- the system ID for the schema. This is used to resolve references to other schemas.parent
- the parent collection.public XmlSchema(String namespace, XmlSchemaCollection parent)
namespace
- the target namespace.parent
- the containing collection.public Document[] getAllSchemas()
XmlSchemaExternal
objects corresponding to them
have their 'schema' fields filled in.public XmlSchemaAttribute getAttributeByName(QName name)
name
- public XmlSchemaAttribute getAttributeByName(String name)
name
- public XmlSchemaForm getAttributeFormDefault()
public XmlSchemaAttributeGroup getAttributeGroupByName(QName name)
name
- public Map<QName,XmlSchemaAttributeGroup> getAttributeGroups()
public Map<QName,XmlSchemaAttribute> getAttributes()
public XmlSchemaDerivationMethod getBlockDefault()
public XmlSchemaElement getElementByName(QName name)
name
- public XmlSchemaElement getElementByName(String name)
name
- public XmlSchemaForm getElementFormDefault()
public Map<QName,XmlSchemaElement> getElements()
public List<XmlSchemaExternal> getExternals()
public XmlSchemaDerivationMethod getFinalDefault()
public XmlSchemaGroup getGroupByName(QName name)
name
- public Map<QName,XmlSchemaGroup> getGroups()
public String getInputEncoding()
setInputEncoding(String)
.public List<XmlSchemaObject> getItems()
public String getLogicalTargetNamespace()
public NamespacePrefixList getNamespaceContext()
getNamespaceContext
in interface NamespaceContextOwner
public XmlSchemaNotation getNotationByName(QName name)
name
- public Map<QName,XmlSchemaNotation> getNotations()
public XmlSchemaCollection getParent()
public Document getSchemaDocument() throws XmlSchemaSerializer.XmlSchemaSerializerException
XmlSchemaSerializer.XmlSchemaSerializerException
public String getSchemaNamespacePrefix()
public Map<QName,XmlSchemaType> getSchemaTypes()
public String getTargetNamespace()
getLogicalTargetNamespace()
public XmlSchemaType getTypeByName(QName name)
name
- the type name.public XmlSchemaType getTypeByName(String name)
name
- public String getVersion()
public void setAttributeFormDefault(XmlSchemaForm value)
value
- the form. This may not be null.public void setBlockDefault(XmlSchemaDerivationMethod blockDefault)
blockDefault
- the new block value.public void setElementFormDefault(XmlSchemaForm elementFormDefault)
elementFormDefault
- the element form. This may not be null.public void setFinalDefault(XmlSchemaDerivationMethod finalDefault)
finalDefault
- the new final value.public void setInputEncoding(String encoding)
encoding
- Character encoding name.public void setNamespaceContext(NamespacePrefixList namespaceContext)
public void setSchemaNamespacePrefix(String schemaNamespacePrefix)
schemaNamespacePrefix
- public void setTargetNamespace(String targetNamespace)
targetNamespace
- the new target namespace URI. A value of "" is ignored.public String toString()
toString
in class XmlSchemaAnnotated
public void write(OutputStream out) throws UnsupportedEncodingException
setInputEncoding(String)
.out
- - the output stream to write toUnsupportedEncodingException
- for an invalid encoding.public void write(OutputStream out, Map<String,String> options) throws UnsupportedEncodingException
setInputEncoding(String)
.out
- - the output stream to write tooptions
- - a map of optionsUnsupportedEncodingException
public void write(Writer writer)
Writer
.writer
- - the writer to write thispublic void write(Writer writer, Map<String,String> options)
Writer
.writer
- - the writer to write thisprotected XmlSchemaAttribute getAttributeByName(QName name, boolean deep, Stack<XmlSchema> schemaStack)
protected XmlSchemaAttributeGroup getAttributeGroupByName(QName name, boolean deep, Stack<XmlSchema> schemaStack)
protected XmlSchemaElement getElementByName(QName name, boolean deep, Stack<XmlSchema> schemaStack)
protected XmlSchemaGroup getGroupByName(QName name, boolean deep, Stack<XmlSchema> schemaStack)
protected XmlSchemaNotation getNotationByName(QName name, boolean deep, Stack<XmlSchema> schemaStack)
protected XmlSchemaType getTypeByName(QName name, boolean deep, Stack<XmlSchema> schemaStack)
name
- deep
- schemaStack
- Copyright © 2004–2017 The Apache Software Foundation. All rights reserved.