Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.schema
Class SOMBasic

    java.lang.Object
      com.bea.schema.SOMObject
          com.bea.schema.SOMBasic

All Implemented Interfaces:
  Serializable, SOMReference

Direct Known Subclasses:
  SOMAttribute, SOMElement

public abstract class SOMBasic
extends SOMObject
implements SOMReference

Abstract base class for SOMElement and SOMAttribute. SOMBasic provides the functionality common to both SOMElement and SOMAttribute.

Version:
  1.0
Author:
  sharpe
See Also:
  `SOMAttribute`, `SOMElement`, `SOMSchema`, Serialized Form

Constructor Summary
`SOMBasic(SOMBasic ref)` Construct an element using another element as a reference.
`SOMBasic(String name)`

Method Summary
`SOMAnnotation` | `addAnnotation()` create a new empty annotation element for this element.
`SOMAnnotation` | `addAnnotation(SOMAnnotation annotation)` add an annotation to the schema tree.
`SOMComplexType` | `addComplexType()` sets the element type to a newly constructed complexType.
`SOMDocumentation` | `addDocumentation(String info)` adds a documentation element to a new annotation element for this element.
`SOMSequence` | `addSequence()` adds a SOMSequence to this element.
`SOMSimpleType` | `addSimpleType()` sets the element type to a newly constructed simpleType.
`boolean` | `contains(SOMObject child)` Determine if an object is child of this element.
`void` | `createDefault(DefaultDocumentOptions options, Element current)` create a default org.w3c.dom.Element.
`SOMAnnotation` | `getAnnotation()` return the associated Annotation object
`Map` | `getAttributes(boolean getAll)` retrieve the attributes for this schema element.
`String` | `getDefault()` get the "default" attribute.
`String` | `getFixed()` get the "fixed" attribute.
`String` | `getForm()` get the "form" attribute.
`String` | `getName()` get the "name" attribute.
`SOMReference` | `getRef()` get the "ref" attribute.
`SOMType` | `getType()` get the "type" attribute as a SOMType object.
`String` | `getTypeName()` get the "type" attribute as a String.
`boolean` | `isRef()` Is this element a reference to another element.
`boolean` | `isValidatingContent()` get the current validation setting
`SOMAnnotation` | `removeAnnotation()` set the annotation for this type to null.
`void` | `setDefault(String p_default)` The default attribute for an schema element.
`void` | `setFixed(String fixed)` The fixed attribute for an schema element.
`void` | `setForm(String form)` set the "form" attribute.
`void` | `setName(String name)` set the "name" attribute.
`void` | `setRef(SOMReference ref)` set the element to which this element should reference.
`void` | `setRef(SOMUnresolvedReference ref)` set the element to which this element should reference.
`SOMType` | `setType(SOMType type)` sets the type attribute or complexType/simpleType for the element.
`void` | `toXML(Writer rtn, int indent)` Outputs a formatted XML representation of SOMObject.

Methods inherited from class com.bea.schema.SOMObject
`addPrefixMapping, getContainmentXPath, getEffectivePrefixMappings, getID_UQ, getID, 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`

Methods inherited from interface com.bea.schema.SOMReference
`getID`

Constructor Detail

### SOMBasic

    public SOMBasic(String name)

### SOMBasic

    public SOMBasic(SOMBasic ref)

  Construct an element using another element as a reference.

       <element name="name" type="xsd:string">

       <element ref="name">

       SOMElement name = new SOMElement("name", SOMType.STRING);

       SOMElement name_reference = new SOMElement(name);

Parameters:
  `ref` - the element to be used as a reference point

Method Detail

### setName

    public void setName(String name)

  set the "name" attribute. The actual name of the element.

  Parameters:
    `name` - the element name

### setForm

    public void setForm(String form)

  set the "form" attribute.

  If form is present and its actual value is qualified, or if form is absent and the actual value of attributeFormDefault on the <schema>ancestor is qualified, then the actual value of the targetNamespace [attribute] of the parent <schema> element information item, or absent if there is none, otherwise absent.

  Valid values for form:

  - qualified
  - unqualified

  Parameters:
    `form` - qualified or unqualified

### setFixed

    public void setFixed(String fixed)

  The fixed attribute for an schema element. This attribute specifies a value for the XML instance document element that is fixed and cannot be any other value.

  Setting the fixed attribute causes the default attribute to be erased. fixed and default must not both be present.

  Parameters:
    `fixed` - the value for this instance document element

### setDefault

    public void setDefault(String p_default)

  The default attribute for an schema element. This attribute specifies a value for the XML instance document element that is default'ed if none is present in the XML instance document.

  Setting the default attribute causes the fixed attribute to be erased. fixed and "default" must not both be present.

  Parameters:
    `p_default` - The default value for this element

### setRef

    public void setRef(SOMReference ref)

  set the element to which this element should reference.

  Specified by:
    `setRef` in interface `SOMReference`
  Parameters:
    `ref` - the element to be referenced

### setRef

    public void setRef(SOMUnresolvedReference ref)

  set the element to which this element should reference.

  Parameters:
    `ref` - the element to be referenced

### setType

    public SOMType setType(SOMType type)

  sets the type attribute or complexType/simpleType for the element. To remove the type setting, call setType(null) with a null value. The type value can be a SOMUserDefinedType, like SOMComplexType and SOMSimpleType, or a SOMElementalType, like PrimitiveString (i.e., SOMType.STRING)

  Parameters:
    `type` - The type value for this element
  Returns:
    the type

### getName

    public String getName()

  get the "name" attribute.

  Specified by:
    `getName` in interface `SOMReference`

### getForm

    public String getForm()

  get the "form" attribute.

### getDefault

    public String getDefault()

  get the "default" attribute.

### getFixed

    public String getFixed()

  get the "fixed" attribute.

### isRef

    public boolean isRef()

  Is this element a reference to another element. If the getRef method would return null, this method will return false. Otherwise, it will return true.

  Returns:
    true if getRef method does not return null

### getRef

    public SOMReference getRef()

  get the "ref" attribute.

### getType

    public SOMType getType()

  get the "type" attribute as a SOMType object. Note that this object will have only the local name for the resolved type (if any name was given) to that type. For example if this element refers to a user defined type called 'bar' and this type was defined in a schema with targetNamespace mapped to a prefix of 'foo', then the type attribute in XML would be 'foo:bar', but the SOMType returned from this method would have a name of just 'bar'. If you wish to get back the original qualified type name, use getTypeName() instead.

### getTypeName

    public String getTypeName()

  get the "type" attribute as a String. Note that the returned string will represent the exact name specified in the XML for the element's type attribute, including any namespace prefix.

### addDocumentation

    public SOMDocumentation addDocumentation(String info)

  adds a documentation element to a new annotation element for this element. This method will create a new annotation at the root under this element and then add the new documentation element to that annotation. Same as the longer process:

       SOMAttribute myAttr ...
       ...
       SOMAnnotation note = myAttr.addAnnotation();
       note.addDocumentation(info);

  Parameters:
    `info` - The documentation string to be added
  Returns:
    a reference to the newly created documentation object

### addAnnotation

    public SOMAnnotation addAnnotation()

  create a new empty annotation element for this element. The annotation object is created and then added to the element tree.

  Returns:
    the newly created annotation object.

### addAnnotation

    public SOMAnnotation addAnnotation(SOMAnnotation annotation)

  add an annotation to the schema tree. If the annotation exists in another tree, it will first be removed and then added to this tree.

  Parameters:
    `annotation` - a previously created annotation
  Returns:
    the annotation that was added.

### removeAnnotation

    public SOMAnnotation removeAnnotation()

  set the annotation for this type to null.

  Returns:
    the removed annotation, or null if none was present

### addComplexType

    public SOMComplexType addComplexType()

  sets the element type to a newly constructed complexType. This utility method tries to simplify coding for the user by creating a new SOMComplexType and passing it to the setType method.

  Returns:
    a reference to the newly created complexType

### addSimpleType

    public SOMSimpleType addSimpleType()

  sets the element type to a newly constructed simpleType. This utility method tries to simplify coding for the user by creating a new SOMSimpleType and passing it to the setType method.

  Returns:
    a reference to the newly created simpleType

### addSequence

    public SOMSequence addSequence()

  adds a SOMSequence to this element. The addSequence method of SOMComplexType is called to create a new SOMSequence under a complexType. If the element type is not a SOMComplexType, the type for this element is replaced by a new SOMComplextType ( see addComplexType() ). If the type was already a SOMComplexType, this method attempts to add an additional or initial sequence to the complexType.

  Returns:
    a newly created SOMSequence with a parent of SOMComplexType.

### contains

    public boolean contains(SOMObject child)

  Determine if an object is child of this element.

  Specified by:
    `contains` in interface `SOMReference`
  Parameters:
    `child` - the object in question
  Returns:
    true if the child is contained within this structure

### getAnnotation

    public SOMAnnotation getAnnotation()

  return the associated Annotation object

  Returns:
    SOMAnnotation

### 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.

  Parameters:
    `getAll` - get all attributes
  Returns:
    a Hashtable of attributes, where the attribute name and value are stored as strings.

### toXML

    public void toXML(Writer rtn,
                      int indent)
               throws IOException

  Description copied from class: `SOMObject`
  Outputs a formatted XML representation of SOMObject.

  Specified by:
    `toXML` in class `SOMObject`
  Parameters:
    `rtn` - printable XML Schema
    `indent` - the indent level for formatting at which to start this schema object.
  Throws:
    `IOException` - if IOExcpetion is thrown by underlying java.io.Writer

### createDefault

    public void createDefault(DefaultDocumentOptions options,
                              Element current)

  create a default org.w3c.dom.Element. Used by createDefaultDocument in SOMSchema

  Parameters:
    `options` - Default options
    `current` - the current Element to be modified
  See Also:
    `SOMSchema`

### isValidatingContent

    public boolean isValidatingContent()

  get the current validation setting

  Returns:
    false if element and attribute content should be validated.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD