com.bea.schema
Class SOMElement

java.lang.Object
  extended bycom.bea.schema.SOMObject
      extended bycom.bea.schema.SOMBasic
          extended bycom.bea.schema.SOMElement
All Implemented Interfaces:
Serializable, SOMReference

public class SOMElement
extends SOMBasic

<element> The XML representation for an element declaration schema component is an <element> element information item. It specifies a type definition for an element either by reference or explicitly, and may provide occurrence and default information.

Version:
1.0
Author:
sharpe
See Also:
SOMSchema, Serialized Form

Constructor Summary
SOMElement(SOMElement ref)
          Construct an <element>
SOMElement(String name)
          Construct an <element> where type is defaulted to SOMType.STRING
SOMElement(String name, SOMType type)
          Construct an <element>
 
Method Summary
 boolean getAbstract()
          get the "abstract" attribute.
 String getAbstractString()
          get the "abstract" attribute.
 Map getAttributes(boolean getAll)
          retrieve the attributes for this schema element.
 String getBlock()
          get the "block" attribute.
 SOMElement getElement(String locationString)
          Lookup an element within this element.
 String getEquivClass()
          get the "equivClass" attribute.
 String getFinal()
          get the "final" attribute.
 String getID()
          <xsd:element>
 int getMaxOccurs()
          maxOccurs attribute for schema element.
 String getMaxOccursString()
          maxOccurs attribute for schema element, as a string.
 int getMinOccurs()
          minOccurs attribute for schema element.
 int getMinOccurs(DefaultDocumentOptions options)
          minOccurs attribute for schema element.
 String getMinOccursString()
          minOccurs attribute for schema element, as a string.
 boolean getNillable()
          get the "nillable" attribute.
 String getNillableString()
          get the "nillable" attribute.
 String getSubstitutionGroup()
          get the "substitutionGroup" attribute.
 boolean isGlobal()
          Is this a top-level global element?
 boolean isValid(Element element, List errorList)
          Validates an DOM Element against an XML Schema.
 void setAbstract(boolean p_abstract)
          set the "abstract" attribute.
 void setAbstract(String p_abstract)
          set the "abstract" attribute.
 void setBlock(String p_block)
          set the "block" attribute.
 void setEquivClass(String p_equivClass)
          set the "equivclass" attribute.
 void setFinal(String p_final)
          set the "final" attribute.
 void setMaxOccurs(int maxOccurs)
          The maxOccurs attribute for schema element.
 void setMaxOccurs(String maxOccurs)
          The maxOccurs attribute for schema element.
 void setMinOccurs(int minOccurs)
          The minOccurs attribute for schema element.
 void setMinOccurs(String minOccurs)
          The minOccurs attribute for schema element.
 void setNillable(boolean nillable)
          set the "nillable" attribute.
 void setNillable(String nillable)
          set the "block" attribute.
 void setSubstitutionGroup(String substitutionGroup)
          set the "substitionGroup" attribute.
 
Methods inherited from class com.bea.schema.SOMBasic
addAnnotation, addAnnotation, addComplexType, addDocumentation, addSequence, addSimpleType, contains, createDefault, getAnnotation, getDefault, getFixed, getForm, getName, getRef, getType, getTypeName, isRef, isValidatingContent, removeAnnotation, setDefault, setFixed, setForm, setName, setRef, setRef, setType, toXML
 
Methods inherited from class com.bea.schema.SOMObject
addPrefixMapping, getContainmentXPath, getEffectivePrefixMappings, getID_UQ, getParent, getParentName, getParentSchema, getPrefixForTargetNamespace, getPrefixMapping, getTargetNamespace, getURIForPrefix, isCircularReference, isSchemaChild, msg, msg, removeNamespaceQualifier, removePrefixMapping, setIndent, setParent, setTargetNamespace, toString, toXML, toXML, toXML
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SOMElement

public SOMElement(String name)
Construct an <element> where type is defaulted to SOMType.STRING

Parameters:
name - <element name="...">

SOMElement

public SOMElement(String name,
                  SOMType type)
Construct an <element>

Parameters:
name - <element name="...">
type - <element type="..."> If the type parameter is null, the default type is set to SOMType.STRING.

SOMElement

public SOMElement(SOMElement ref)
Construct an <element>

Parameters:
ref - <element ref="...">
Method Detail

setAbstract

public void setAbstract(boolean p_abstract)
set the "abstract" attribute.

Parameters:
p_abstract - true or false, default is false

setAbstract

public void setAbstract(String p_abstract)
set the "abstract" attribute. The setAbstract method is overloaded to support the input of a string value. The argument, p_abstract, must be the string equivalent of a boolean value, true or false.

Parameters:
p_abstract - true or false, default is false
See Also:
setAbstract(boolean)

setBlock

public void setBlock(String p_block)
set the "block" attribute.


setEquivClass

public void setEquivClass(String p_equivClass)
set the "equivclass" attribute.


setFinal

public void setFinal(String p_final)
set the "final" attribute.


setMinOccurs

public void setMinOccurs(String minOccurs)
The minOccurs attribute for schema element. The default value is '1'.

Parameters:
minOccurs - a nonNegativeInteger

setMinOccurs

public void setMinOccurs(int minOccurs)
The minOccurs attribute for schema element. The default value is '1'.

Parameters:
minOccurs - a nonNegativeInteger

setMaxOccurs

public void setMaxOccurs(String maxOccurs)
The maxOccurs attribute for schema element. The default value is '1'.

Parameters:
maxOccurs - a nonNegativeInteger or "unbounded"

setMaxOccurs

public void setMaxOccurs(int maxOccurs)
The maxOccurs attribute for schema element. The default value is '1'.

Any negative number is treated as "unbounded"

Parameters:
maxOccurs - a nonNegativeInteger or -1 (unbounded)

setNillable

public void setNillable(boolean nillable)
set the "nillable" attribute.


setNillable

public void setNillable(String nillable)
set the "block" attribute. Same as setNillable(Boolean.valueOf(nillable).booleanValue())

Parameters:
nillable - boolean value in string form

setSubstitutionGroup

public void setSubstitutionGroup(String substitutionGroup)
set the "substitionGroup" attribute.


getMinOccurs

public int getMinOccurs(DefaultDocumentOptions options)
minOccurs attribute for schema element.

Parameters:
options - DefaultDocumentOptions used in createDefaultDocument
Returns:
the greater of forceMinOccurs and minOccurs for this element

getMinOccurs

public int getMinOccurs()
minOccurs attribute for schema element.

Returns:
minOccurs value for this element

getMinOccursString

public String getMinOccursString()
minOccurs attribute for schema element, as a string.

Returns:
minOccurs value for this element

getMaxOccurs

public int getMaxOccurs()
maxOccurs attribute for schema element.

Returns:
maxOccurs value for this element

getMaxOccursString

public String getMaxOccursString()
maxOccurs attribute for schema element, as a string.

Returns:
maxOccurs value for this element, or "unbounded"

getAbstract

public boolean getAbstract()
get the "abstract" attribute.


getAbstractString

public String getAbstractString()
get the "abstract" attribute.


getBlock

public String getBlock()
get the "block" attribute.


getEquivClass

public String getEquivClass()
get the "equivClass" attribute.


getFinal

public String getFinal()
get the "final" attribute.


getNillable

public boolean getNillable()
get the "nillable" attribute.


getNillableString

public String getNillableString()
get the "nillable" attribute.


getSubstitutionGroup

public String getSubstitutionGroup()
get the "substitutionGroup" attribute.


getID

public String getID()
<xsd:element>

Specified by:
getID in interface SOMReference
Specified by:
getID in class SOMObject
Returns:
String representation of the element tag

getAttributes

public Map getAttributes(boolean getAll)
retrieve the attributes for this schema element. If getAll is false, only the attributes that are not set to their default value are returned. If getAll is true, all possible attributes for this element will be returned.

Overrides:
getAttributes in class SOMBasic
Parameters:
getAll - get all attributes
Returns:
a Hashtable of attributes, where the attribute name and value are stored as strings.

getElement

public SOMElement getElement(String locationString)
Lookup an element within this element. Using a virtual path, the reference to the SOMElement is returned. For example, using the virtual path string "/purchaseOrder/items/item" on the PurchaseOrder schema would return a reference to the SOMElement name="item".

Virtual Path nodes must be separated by the forward slash, "/"

Parameters:
locationString - a virtual element path where nodes are separated by the forward slash, "/"
Returns:
SOMElement or null if locationString could not be resolved.
See Also:
SOMSchema.getElement(java.lang.String)

isGlobal

public boolean isGlobal()
Is this a top-level global element?


isValid

public boolean isValid(Element element,
                       List errorList)
Validates an DOM Element against an XML Schema. If the element is valid, the isValid method returns true and the List of errors will be empty.

The error list is cleared before beginning the validation. The List implementation used must support the clear() method.

Elements of the list are instances of the class SOMValidationException.

Parameters:
element -
errorList -
Returns:
true if the DOM Element is valid within this schema