com.bowstreet.xml.schema
Class SchemaCreatorComponent

java.lang.Object
  extended by com.bowstreet.xml.schema.SchemaCreatorComponent
Direct Known Subclasses:
SchemaCreator

public class SchemaCreatorComponent
extends java.lang.Object

Cleass that represents an element of schema under construction by SchemaCreator.


Method Summary
 void addAnnotation(java.lang.String s)
          Adds an annotation to the current sequence if any, or schema if no sequence.
 void addAttribute(java.lang.String attributeName, java.lang.String type)
          Adds an attribute to this component.
 SchemaCreatorComponent addComplexType(java.lang.String elementName)
          Add a complex type (which can in turn have child elements)
 SchemaCreatorComponent addComplexType(java.lang.String elementName, java.lang.String minOccurs, java.lang.String maxOccurs)
          Add a complex type, specifying minOccurs and maxOccurs
 SchemaCreatorComponent addElement(java.lang.String name, java.lang.String type, java.lang.String minOccurs, java.lang.String maxOccurs)
          Adds a new element to the current sequence with name, type, and optionally minOccurs, maxOccurs.
 void addElementUsingType(java.lang.String elementName, java.lang.String typeName, java.lang.String minOccurs, java.lang.String maxOccurs)
          Adds an element that references a type defined in this schema.
 void addElementUsingType(java.lang.String elementName, java.lang.String namespacePrefix, java.lang.String typeName, java.lang.String minOccurs, java.lang.String maxOccurs)
          Adds an element that references a type defined in this schema.
 SchemaCreatorComponent addElementWithRestrictions(java.lang.String name, java.lang.String type, java.lang.String minOccurs, java.lang.String maxOccurs)
          Adds a new element to the current sequence with name, minOccurs, maxOccurs, and also add a restriction with a base value of type, ready to receive the restriction values.
 void addEnumerations(java.lang.String[] f)
          Add enumerations to a restirction element already added.
 SchemaCreatorComponent addLocalComplexType(java.lang.String elementName)
          Add a local complex type (which can in turn have child elements).
 SchemaCreatorComponent addLocalComplexType(java.lang.String elementName, java.lang.String minOccurs, java.lang.String maxOccurs)
          Add a local complex type, specifying minOccurs and maxOccurs.
 SchemaCreatorComponent addRealComplexType(java.lang.String typeName)
          Really does add a complexType definition.
 void addReferenceToElement(java.lang.String name, java.lang.String minOccurs, java.lang.String maxOccurs)
          Add a reference to an existing element.
 void addReferenceToElement(java.lang.String namespacePrefix, java.lang.String name, java.lang.String minOccurs, java.lang.String maxOccurs)
          Add a reference to an existing element using the specified namespace prefix and name.
 SchemaCreatorComponent addSimpleContentExtension(java.lang.String elementName, java.lang.String type, java.lang.String minOccurs, java.lang.String maxOccurs)
          Add a simpleContent extension of an xsd type, specifying minOccurs and maxOccurs
 void addSimpleElement(java.lang.String elementName, java.lang.String type)
          Add a simple element, e.g. string, dateTime, double
 void addSimpleElement(java.lang.String elementName, java.lang.String type, java.lang.String minOccurs, java.lang.String maxOccurs)
          Calls addSimpleElement and then sets the (optional) minOccurs and maxOccurs values.
 void addStringElement(java.lang.String elementName)
          Adds a simple string element to this component.
 SchemaCreatorComponent addTopLevelElement(java.lang.String name, java.lang.String type, java.lang.String minOccurs, java.lang.String maxOccurs)
          Adds a new element at the top schema level with name, type, and optionally minOccurs, maxOccurs.
 SchemaCreatorComponent addTopLevelElementWithRestrictions(java.lang.String name, java.lang.String type, java.lang.String minOccurs, java.lang.String maxOccurs)
          Adds a new element to the schema at the top level with name, minOccurs, maxOccurs, and also add a restriction with a base value of type, ready to receive the restriction values.
 void setMaxLength(java.lang.String s)
          Set maxLength on the current seq element
 java.lang.String toString()
          Get the XML as a String for the generated schema.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

addAnnotation

public void addAnnotation(java.lang.String s)
Adds an annotation to the current sequence if any, or schema if no sequence.

Parameters:
s - the annotation

addAttribute

public void addAttribute(java.lang.String attributeName,
                         java.lang.String type)
Adds an attribute to this component.

Parameters:
attributeName - Name of the attribute.
type - xsd type of the attribute.

addComplexType

public SchemaCreatorComponent addComplexType(java.lang.String elementName)
Add a complex type (which can in turn have child elements)

Parameters:
elementName - Name of the complex type
Returns:
Child SchemaCreatorElement

addComplexType

public SchemaCreatorComponent addComplexType(java.lang.String elementName,
                                             java.lang.String minOccurs,
                                             java.lang.String maxOccurs)
Add a complex type, specifying minOccurs and maxOccurs

Parameters:
elementName - Name of the complex type
minOccurs - Value of "minOccurs" attribute
maxOccurs - Value of "maxOccurs" attribute
Returns:
Child SchemaCreatorElement

addElement

public SchemaCreatorComponent addElement(java.lang.String name,
                                         java.lang.String type,
                                         java.lang.String minOccurs,
                                         java.lang.String maxOccurs)
Adds a new element to the current sequence with name, type, and optionally minOccurs, maxOccurs.

Parameters:
name - Name of the element.
type - The xsd type of the element (e.g. string).
minOccurs - minOccurs value, ignored if null
maxOccurs - maxOccurs value, ignored if null
Returns:
the SchemaCreatorComponent created

addElementUsingType

public void addElementUsingType(java.lang.String elementName,
                                java.lang.String typeName,
                                java.lang.String minOccurs,
                                java.lang.String maxOccurs)
Adds an element that references a type defined in this schema.

Parameters:
elementName - name of the element to be added
typeName - name of the type to be referenced
minOccurs - Value of "minOccurs" attribute
maxOccurs - Value of "maxOccurs" attribute

addElementUsingType

public void addElementUsingType(java.lang.String elementName,
                                java.lang.String namespacePrefix,
                                java.lang.String typeName,
                                java.lang.String minOccurs,
                                java.lang.String maxOccurs)
Adds an element that references a type defined in this schema.

Parameters:
elementName - name of the element to be added
namespacePrefix - The namespace prefix of the type to be referenced
typeName - name of the type to be referenced
minOccurs - Value of "minOccurs" attribute
maxOccurs - Value of "maxOccurs" attribute

addElementWithRestrictions

public SchemaCreatorComponent addElementWithRestrictions(java.lang.String name,
                                                         java.lang.String type,
                                                         java.lang.String minOccurs,
                                                         java.lang.String maxOccurs)
Adds a new element to the current sequence with name, minOccurs, maxOccurs, and also add a restriction with a base value of type, ready to receive the restriction values.

Parameters:
name - Name of the element.
type - The xsd type of the element (e.g. string).
minOccurs - minOccurs value, ignored if null
maxOccurs - maxOccurs value, ignored if null
Returns:
the SchemaCreatorComponent created

addEnumerations

public void addEnumerations(java.lang.String[] f)
Add enumerations to a restirction element already added.

Parameters:
f - the enumerations

addLocalComplexType

public SchemaCreatorComponent addLocalComplexType(java.lang.String elementName)
Add a local complex type (which can in turn have child elements). The complex type will be defined locally instead of globally.

Parameters:
elementName - Name of the complex type
Returns:
Child SchemaCreatorElement

addLocalComplexType

public SchemaCreatorComponent addLocalComplexType(java.lang.String elementName,
                                                  java.lang.String minOccurs,
                                                  java.lang.String maxOccurs)
Add a local complex type, specifying minOccurs and maxOccurs. The complex type will be defined locally instead of globally.

Parameters:
elementName - Name of the complex type
minOccurs - Value of "minOccurs" attribute
maxOccurs - Value of "maxOccurs" attribute
Returns:
Child SchemaCreatorElement

addRealComplexType

public SchemaCreatorComponent addRealComplexType(java.lang.String typeName)
Really does add a complexType definition. "addComplexType" actually adds an element.

Parameters:
typeName - name of the type to be added
Returns:
the complex type added

addReferenceToElement

public void addReferenceToElement(java.lang.String name,
                                  java.lang.String minOccurs,
                                  java.lang.String maxOccurs)
Add a reference to an existing element.

Parameters:
name - name of the element.
minOccurs - minOccurs value, ignored if null
maxOccurs - maxOccurs value, ignored if null

addReferenceToElement

public void addReferenceToElement(java.lang.String namespacePrefix,
                                  java.lang.String name,
                                  java.lang.String minOccurs,
                                  java.lang.String maxOccurs)
Add a reference to an existing element using the specified namespace prefix and name.

Parameters:
namespacePrefix - The namespace prefix for the specified name.
name - name of the element.
minOccurs - minOccurs value, ignored if null
maxOccurs - maxOccurs value, ignored if null

addSimpleContentExtension

public SchemaCreatorComponent addSimpleContentExtension(java.lang.String elementName,
                                                        java.lang.String type,
                                                        java.lang.String minOccurs,
                                                        java.lang.String maxOccurs)
Add a simpleContent extension of an xsd type, specifying minOccurs and maxOccurs

Parameters:
elementName - Name of the complex type
type - The xsd type of the element (e.g. string).
minOccurs - Value of "minOccurs" attribute
maxOccurs - Value of "maxOccurs" attribute
Returns:
Child SchemaCreatorElement

addSimpleElement

public void addSimpleElement(java.lang.String elementName,
                             java.lang.String type)
Add a simple element, e.g. string, dateTime, double

Parameters:
elementName - Name of the element.
type - The xsd type of the element (e.g. string).

addSimpleElement

public void addSimpleElement(java.lang.String elementName,
                             java.lang.String type,
                             java.lang.String minOccurs,
                             java.lang.String maxOccurs)
Calls addSimpleElement and then sets the (optional) minOccurs and maxOccurs values.

Parameters:
elementName - Name of the element.
type - The xsd type of the element (e.g. string).
minOccurs - minOccurs value, ignored if null
maxOccurs - maxOccurs value, ignored if null

addStringElement

public void addStringElement(java.lang.String elementName)
Adds a simple string element to this component.

Parameters:
elementName - Name of the element.

addTopLevelElement

public SchemaCreatorComponent addTopLevelElement(java.lang.String name,
                                                 java.lang.String type,
                                                 java.lang.String minOccurs,
                                                 java.lang.String maxOccurs)
Adds a new element at the top schema level with name, type, and optionally minOccurs, maxOccurs.

Parameters:
name - Name of the element.
type - The xsd type of the element (e.g. string).
minOccurs - minOccurs value, ignored if null
maxOccurs - maxOccurs value, ignored if null
Returns:
the SchemaCreatorComponent created

addTopLevelElementWithRestrictions

public SchemaCreatorComponent addTopLevelElementWithRestrictions(java.lang.String name,
                                                                 java.lang.String type,
                                                                 java.lang.String minOccurs,
                                                                 java.lang.String maxOccurs)
Adds a new element to the schema at the top level with name, minOccurs, maxOccurs, and also add a restriction with a base value of type, ready to receive the restriction values.

Parameters:
name - Name of the element.
type - The xsd type of the element (e.g. string).
minOccurs - minOccurs value, ignored if null
maxOccurs - maxOccurs value, ignored if null
Returns:
the SchemaCreatorComponent created

setMaxLength

public void setMaxLength(java.lang.String s)
Set maxLength on the current seq element

Parameters:
s - the length

toString

public java.lang.String toString()
Get the XML as a String for the generated schema.

Overrides:
toString in class java.lang.Object
Returns:
The XML as a String for the schema.


Copyright © 2009 IBM. All Rights Reserved.