public interface SchemaVisitor
SchemaVisitor is used to generate the XSD schema. Since XMLVisitor
generates the XML, there is a strong relationship between a SchemaVisitor
implementation and the corresponding XMLVisitor implementation.
While XMLVisitor is used to generate XML instance documents from XMLObjects, the SchemaVisitor is used to generate XML Schema documents from XMLModels associated with those XMLObjects.
| Field Summary | |
|---|---|
static java.lang.String |
ANNOTATION
Comment for ANNOTATION: The xsd:annotation tag |
static java.lang.String |
COMPLEX_TYPE
Comment for COMPLEX_TYPE: The xsd:complexType tag |
static java.lang.String |
DESCRIPTION
Comment for DESCRIPTION: The xsd:description tag |
static java.lang.String |
ELEMENT
Comment for ELEMENT: The xsd:element tag |
static java.lang.String |
ELEMENT_FORM_DEFAULT_ATTR
Comment for ELEMENT_FORM_DEFAULT_ATTR: The
elementFormDefault attribute |
static java.lang.String |
IMPORT
Comment for IMPORT: The xsd:import tag |
static java.lang.String |
SCHEMA
Comment for SCHEMA: The xsd:schema tag |
static java.lang.String |
SCHEMA_NAMESPACE
The namespace of XSD schemas |
static java.lang.String |
SCHEMA_NAMESPACE_PREFIX
SCHEMA_NAMESPACE_PREFIX: the standard namespace prefix to
use for elements in the XSD namespace. |
static java.lang.String |
SEQUENCE
Comment for SEQUENCE: The xsd:sequence |
static java.lang.String |
SIMPLE_TYPE
Comment for SIMPLE_TYPE: The xsd:simpleType tag |
static java.lang.String |
TARGETNAMESPACE_ATTR
Comment for TARGETNAMESPACE_ATTR: The targetNamespace
attribute |
| Method Summary | |
|---|---|
void |
endChoice()
Ends an xs:choice segment |
void |
endContainerElement(java.lang.String namespace,
java.lang.String tag)
Closes a container element |
void |
endSequence()
Ends an xs:sequence segment |
void |
endTopContainerElement(java.lang.String namespace,
java.lang.String tag)
|
void |
setSchemaReferences(java.util.List list)
SchemaReference provides a mapping from a namespace to the URL location of the schema. |
void |
startChoice()
Starts an xs:choice segment |
void |
startContainerElement(java.lang.String namespace,
java.lang.String tag,
java.lang.String minOccurs,
java.lang.String maxOccurs)
Starts a nested container element. |
void |
startSequence()
Starts an xs:sequence |
void |
startTopContainerElement(java.lang.String namespace,
java.lang.String tag)
Starts a toplevel element that can contain additional child elements. |
void |
visitDateElement(java.lang.String namespace,
java.lang.String tag,
java.lang.String minOccurs,
java.lang.String maxOccurs)
Generates the schema for a date |
void |
visitElement(java.lang.String namespace,
java.lang.String tag,
XSDBaseType type,
java.lang.String minOccurs,
java.lang.String maxOccurs)
Creates a toplevel element definition of type XSD Base type. |
void |
visitElementReference(java.lang.String namespace,
java.lang.String tag,
java.lang.String minOccurs,
java.lang.String maxOccurs)
Starts a container inside an element or type definition. |
void |
visitEmptyContent(java.lang.String namespace,
java.lang.String tag,
java.lang.String minOccurs,
java.lang.String maxOccurs)
Creates definition for empty content model |
void |
visitTopElement(java.lang.String namespace,
java.lang.String tag,
XSDBaseType type)
|
void |
visitTopEmptyContent(java.lang.String namespace,
java.lang.String tag)
|
| Field Detail |
|---|
static final java.lang.String SCHEMA_NAMESPACE
static final java.lang.String SCHEMA_NAMESPACE_PREFIX
SCHEMA_NAMESPACE_PREFIX: the standard namespace prefix to
use for elements in the XSD namespace.
static final java.lang.String SCHEMA
SCHEMA: The xsd:schema tag
static final java.lang.String IMPORT
IMPORT: The xsd:import tag
static final java.lang.String ELEMENT
ELEMENT: The xsd:element tag
static final java.lang.String SIMPLE_TYPE
SIMPLE_TYPE: The xsd:simpleType tag
static final java.lang.String COMPLEX_TYPE
COMPLEX_TYPE: The xsd:complexType tag
static final java.lang.String ANNOTATION
ANNOTATION: The xsd:annotation tag
static final java.lang.String DESCRIPTION
DESCRIPTION: The xsd:description tag
static final java.lang.String SEQUENCE
SEQUENCE: The xsd:sequence
static final java.lang.String TARGETNAMESPACE_ATTR
TARGETNAMESPACE_ATTR: The targetNamespace
attribute
static final java.lang.String ELEMENT_FORM_DEFAULT_ATTR
ELEMENT_FORM_DEFAULT_ATTR: The
elementFormDefault attribute
| Method Detail |
|---|
void visitElement(java.lang.String namespace,
java.lang.String tag,
XSDBaseType type,
java.lang.String minOccurs,
java.lang.String maxOccurs)
throws SchemaGenerationException
namespace - the namespace of this elementtag - the name of this elementtype - the type of the XSDminOccurs - maxOccurs -
SchemaGenerationException
void visitDateElement(java.lang.String namespace,
java.lang.String tag,
java.lang.String minOccurs,
java.lang.String maxOccurs)
throws SchemaGenerationException
namespace - the namespace of the tagtag - the name of the tagminOccurs - maxOccurs -
SchemaGenerationException
void visitTopElement(java.lang.String namespace,
java.lang.String tag,
XSDBaseType type)
throws SchemaGenerationException
namespace - tag - type -
SchemaGenerationException
void visitEmptyContent(java.lang.String namespace,
java.lang.String tag,
java.lang.String minOccurs,
java.lang.String maxOccurs)
throws SchemaGenerationException
namespace - tag - minOccurs - maxOccurs -
SchemaGenerationException
void visitTopEmptyContent(java.lang.String namespace,
java.lang.String tag)
throws SchemaGenerationException
namespace - tag -
SchemaGenerationException
void startSequence()
throws SchemaGenerationException
SchemaGenerationExceptionvoid endSequence()
void startChoice()
void endChoice()
void visitElementReference(java.lang.String namespace,
java.lang.String tag,
java.lang.String minOccurs,
java.lang.String maxOccurs)
throws SchemaGenerationException
<...some container node...>
<xs:element ref="{nsprefix}:{tag}" minOccurs="{minOccurs}" maxOccurs="{maxOccurs}"/>
</...some container node...>
Note you must call startContainerElement(namespace,tag) to
actually define the element.
- Parameters:
namespace - the namespcetag - the xml tagminOccurs - a number or nullmaxOccurs - a number, null or "unbounded"
- Throws:
SchemaGenerationException
void startTopContainerElement(java.lang.String namespace,
java.lang.String tag)
throws SchemaGenerationException
<xs:element name="{tag}">
Note that you must call endContainerElement(namespace, tag) to complete the definition of this element.
namespace - the namespace where this element is locatedtag - the name of the element.
SchemaGenerationException
void startContainerElement(java.lang.String namespace,
java.lang.String tag,
java.lang.String minOccurs,
java.lang.String maxOccurs)
throws SchemaGenerationException
namespace - the namespace of the elementtag - the tagname of the elementminOccurs - minOccursmaxOccurs - maxOccurs
SchemaGenerationException
void endContainerElement(java.lang.String namespace,
java.lang.String tag)
throws SchemaGenerationException
namespace - the namespacetag - the XML tag
SchemaGenerationException
void endTopContainerElement(java.lang.String namespace,
java.lang.String tag)
namespace - tag - void setSchemaReferences(java.util.List list)
list - the array of references to schemas that we expect to generate.