WebLogic Integration


com.bea.schema
Class SOMElement

java.lang.Object
  |
  +--com.bea.schema.SOMObject
        |
        +--com.bea.schema.SOMBasic
              |
              +--com.bea.schema.SOMElement

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.

Author:
Copyright © 2000, 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
SOMSchema, Serialized Form

Constructor Summary
protected SOMElement(org.xml.sax.Attributes attrs, SOMObject parent)
          constructor for use with SAX parser, loading SOM from a file.
  SOMElement(SOMElement ref)
          Construct an <element>
  SOMElement(java.lang.String name)
          Construct an <element> where type is defaulted to SOMType.STRING
  SOMElement(java.lang.String name, SOMType type)
          Construct an <element>
 
Method Summary
 boolean getAbstract()
          get the "abstract" attribute.
 java.lang.String getAbstractString()
          get the "abstract" attribute.
 java.util.Map getAttributes(boolean getAll)
          retrieve the attributes for this schema element.
 java.lang.String getBlock()
          get the "block" attribute.
 SOMElement getElement(java.lang.String locationString)
          Lookup an element within this element.
protected  SOMElement getElement(java.util.StringTokenizer parsedLocation)
          Lookup an element within this element using tokenized virtual path.
 java.lang.String getEquivClass()
          get the "equivClass" attribute.
 java.lang.String getFinal()
          get the "final" attribute.
 java.lang.String getID()
          <xsd:element>
 int getMaxOccurs()
          maxOccurs attribute for schema element.
 java.lang.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.
 java.lang.String getMinOccursString()
          minOccurs attribute for schema element, as a string.
 boolean getNullable()
          get the "nullable" attribute.
 java.lang.String getNullableString()
          get the "nullable" attribute.
 java.lang.String getSubstitutionGroup()
          get the "substitutionGroup" attribute.
 boolean isValid(org.w3c.dom.Element element, java.util.List errorList)
          Validates an DOM Element against an XML Schema.
 void setAbstract(boolean p_abstract)
          set the "abstract" attribute.
 void setAbstract(java.lang.String p_abstract)
          set the "abstract" attribute.
 void setBlock(java.lang.String p_block)
          set the "block" attribute.
 void setEquivClass(java.lang.String p_equivClass)
          set the "equivclass" attribute.
 void setFinal(java.lang.String p_final)
          set the "final" attribute.
 void setMaxOccurs(int maxOccurs)
          The maxOccurs attribute for schema element.
 void setMaxOccurs(java.lang.String maxOccurs)
          The maxOccurs attribute for schema element.
 void setMinOccurs(int minOccurs)
          The minOccurs attribute for schema element.
 void setMinOccurs(java.lang.String minOccurs)
          The minOccurs attribute for schema element.
 void setNullable(boolean nullable)
          set the "nullable" attribute.
 void setNullable(java.lang.String nullable)
          set the "block" attribute.
 void setSubstitutionGroup(java.lang.String substitutionGroup)
          set the "substitionGroup" attribute.
 
Methods inherited from class com.bea.schema.SOMBasic
addAnnotation, addAnnotation, addChild, addComplexType, addDocumentation, addSequence, addSimpleType, getDefault, getFixed, getForm, getName, getRef, getType, isRef, isValidatingContent, removeAnnotation, setDefault, setFixed, setForm, setName, setRef, setRef, setType, toXML
 
Methods inherited from class com.bea.schema.SOMObject
attributesToXML, doIndent, getID_UQ, getParent, getParentSchema, isCircularReference, isSchemaChild, setIndent, setParent, toString, toXML, toXML, toXML, trace, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SOMElement

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

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

SOMElement

public SOMElement(java.lang.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="...">

SOMElement

protected SOMElement(org.xml.sax.Attributes attrs,
                     SOMObject parent)
constructor for use with SAX parser, loading SOM from a file.

Parameters:
attrs -  
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(java.lang.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(java.lang.String p_block)
set the "block" attribute.

setEquivClass

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

setFinal

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

setMinOccurs

public void setMinOccurs(java.lang.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(java.lang.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)

setNullable

public void setNullable(boolean nullable)
set the "nullable" attribute.

setNullable

public void setNullable(java.lang.String nullable)
set the "block" attribute. Same as setNullable(Boolean.valueOf(nullable).booleanValue())

Parameters:
nullable - boolean value in string form

setSubstitutionGroup

public void setSubstitutionGroup(java.lang.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 java.lang.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 java.lang.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 java.lang.String getAbstractString()
get the "abstract" attribute.

getBlock

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

getEquivClass

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

getFinal

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

getNullable

public boolean getNullable()
get the "nullable" attribute.

getNullableString

public java.lang.String getNullableString()
get the "nullable" attribute.

getSubstitutionGroup

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

getID

public java.lang.String getID()
<xsd:element>

Overrides:
getID in class SOMObject

getAttributes

public java.util.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.

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

getElement

public SOMElement getElement(java.lang.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)

getElement

protected SOMElement getElement(java.util.StringTokenizer parsedLocation)
Lookup an element within this element using tokenized virtual path.

this method is used by SOMSchema.getElement and SOMElement.getElement to walk the <element> definitions

Parameters:
parsedLocation - preparsed virtual path
Returns:
SOMElement or null if path could not be resolved

isValid

public boolean isValid(org.w3c.dom.Element element,
                       java.util.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

WebLogic Integration

WebLogic Integration (WLI)