org.jibx.schema.elements
Class SchemaElement

java.lang.Object
  extended by org.jibx.schema.elements.SchemaBase
      extended by org.jibx.schema.elements.OpenAttrBase
          extended by org.jibx.schema.elements.SchemaElement
All Implemented Interfaces:
IComponent

public class SchemaElement
extends OpenAttrBase

Model component for schema element.

Author:
Dennis M. Sosnoski

Field Summary
private  int m_attributeFormDefaultType
          'attributeFormDefault' attribute value (-1 if not set).
private  AllEnumSet m_blockDefault
          'blockDefault' attribute value.
private  LazyList m_dependentSchemas
          Schemas which directly reference this schema.
private  java.lang.String m_effectiveNamespace
          Effective namespace overriding the target namespace (null if unused).
private  int m_elementFormDefaultType
          'elementFormDefault' attribute value (-1 if not set).
private  AllEnumSet m_finalDefault
          'finalDefault' attribute value.
private  java.lang.String m_id
          "id" attribute value.
private  NameRegister m_register
          Register for names from this context.
private  ISchemaResolver m_resolver
          Resolver for this schema.
private  FilteredSegmentList m_schemaChildren
          Filtered list of schema reference child elements.
private  java.lang.String m_targetNamespace
          'targetNamespace' attribute value.
private  FilteredSegmentList m_topLevelChildren
          Filtered list of top-level definition child elements.
private  java.lang.String m_version
          'version' attribute value.
static StringArray s_allowedAttributes
          List of allowed attribute names
private static Logger s_logger
          Logger for class.
private static long SCHEMA_REFERENCE_MASK
          Mask bits for schema reference child elements.
private static long TOP_LEVEL_DEFINITION_MASK
          Mask bits for top-level definition child elements.
 
Fields inherited from class org.jibx.schema.elements.SchemaBase
ALL_TYPE, ANNOTATION_TYPE, ANY_TYPE, ANYATTRIBUTE_TYPE, APPINFO_TYPE, ATTRIBUTE_TYPE, ATTRIBUTEGROUP_TYPE, CHOICE_TYPE, COMPLEXCONTENT_TYPE, COMPLEXTYPE_TYPE, DOCUMENTATION_TYPE, ELEMENT_MASKS, ELEMENT_NAMES, ELEMENT_TYPE, ENUMERATION_TYPE, EXTENSION_TYPE, FIELD_TYPE, FRACTIONDIGITS_TYPE, GROUP_TYPE, IMPORT_TYPE, INCLUDE_TYPE, KEY_TYPE, KEYREF_TYPE, LENGTH_TYPE, LIST_TYPE, MAXEXCLUSIVE_TYPE, MAXINCLUSIVE_TYPE, MAXLENGTH_TYPE, MINEXCLUSIVE_TYPE, MININCLUSIVE_TYPE, MINLENGTH_TYPE, NOTATION_TYPE, PATTERN_TYPE, REDEFINE_TYPE, RESTRICTION_TYPE, SCHEMA_TYPE, SELECTOR_TYPE, SEQUENCE_TYPE, SIMPLECONTENT_TYPE, SIMPLETYPE_TYPE, TOTALDIGITS_TYPE, UNION_TYPE, UNIQUE_TYPE, WHITESPACE_TYPE
 
Fields inherited from interface org.jibx.schema.IComponent
SCHEMA_NAMESPACE
 
Constructor Summary
SchemaElement()
          Constructor.
 
Method Summary
 int getAttributeFormDefault()
          Get 'attributeFormDefault' attribute type code.
 java.lang.String getAttributeFormDefaultText()
          Get 'attributeFormDefault' attribute text.
 AllEnumSet getBlock()
          Get 'blockDefault' attribute.
 java.lang.String getEffectiveNamespace()
          Get the effective namespace which applies to this schema.
 int getElementFormDefault()
          Get 'elementFormDefault' attribute type code.
 java.lang.String getElementFormDefaultText()
          Get 'elementFormDefault' attribute text.
 AllEnumSet getFinal()
          Get 'finalDefault' attribute.
private  java.lang.String getName()
          Get the schema name for logging validation.
 NameRegister getRegister()
          Get register for named components of schema.
 ISchemaResolver getResolver()
          Get resolver.
 FilteredSegmentList getSchemaChildren()
          Get list of schema-related child elements.
 java.lang.String getTargetNamespace()
          Get 'targetNamespace' attribute.
 FilteredSegmentList getTopLevelChildren()
          Get list of top-level definition child elements.
 java.lang.String getVersion()
          Get 'version' attribute.
 boolean isAttributeQualifiedDefault()
          Check if attributes are qualified by default.
 boolean isElementQualifiedDefault()
          Check if elements are qualified by default.
protected  void preset(IUnmarshallingContext ictx)
          Pre-set method to be called by data binding while parsing element start tag.
 void prevalidate(ValidationContext vctx)
          Prevalidate component information.
 void setAttributeFormDefault(int type)
          Set 'attributeFormDefault' attribute type code.
private  void setAttributeFormDefaultText(java.lang.String text, IUnmarshallingContext ictx)
          Set 'attributeFormDefault' attribute text.
 void setEffectiveNamespace(java.lang.String ens)
          Set the effective namespace to be applied to this schema.
 void setElementFormDefault(int type)
          Set 'elementFormDefault' attribute type code.
private  void setElementFormDefaultText(java.lang.String text, IUnmarshallingContext ictx)
          Set 'elementFormDefault' attribute text.
 void setResolver(ISchemaResolver resolver)
          Set resolver.
 void setTargetNamespace(java.lang.String tns)
          Set 'targetNamespace' attribute.
 void setVersion(java.lang.String version)
          Set 'version' attribute.
 void validate(ValidationContext vctx)
          Validate component information.
 
Methods inherited from class org.jibx.schema.elements.OpenAttrBase
addExtraAttribute, clearExtraAttributes, compactChildren, detachChild, getChild, getChildCount, getChildIterator, getChildrenWritable, getExtraAttributes, preget, replaceChild, validateAttributes
 
Methods inherited from class org.jibx.schema.elements.SchemaBase
addNamespaceDeclaration, bit, clearNamespaceDeclarations, getExtension, getNamespaceDeclarations, getParent, getSchema, isGlobal, name, readNamespaces, setExtension, setParent, type, validateAttributes, writeNamespaces
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_logger

private static final Logger s_logger
Logger for class.


s_allowedAttributes

public static final StringArray s_allowedAttributes
List of allowed attribute names


SCHEMA_REFERENCE_MASK

private static final long SCHEMA_REFERENCE_MASK
Mask bits for schema reference child elements.


TOP_LEVEL_DEFINITION_MASK

private static final long TOP_LEVEL_DEFINITION_MASK
Mask bits for top-level definition child elements.


m_schemaChildren

private final FilteredSegmentList m_schemaChildren
Filtered list of schema reference child elements.


m_topLevelChildren

private final FilteredSegmentList m_topLevelChildren
Filtered list of top-level definition child elements.


m_dependentSchemas

private final LazyList m_dependentSchemas
Schemas which directly reference this schema.


m_attributeFormDefaultType

private int m_attributeFormDefaultType
'attributeFormDefault' attribute value (-1 if not set).


m_elementFormDefaultType

private int m_elementFormDefaultType
'elementFormDefault' attribute value (-1 if not set).


m_blockDefault

private AllEnumSet m_blockDefault
'blockDefault' attribute value.


m_finalDefault

private AllEnumSet m_finalDefault
'finalDefault' attribute value.


m_id

private java.lang.String m_id
"id" attribute value.


m_targetNamespace

private java.lang.String m_targetNamespace
'targetNamespace' attribute value.


m_effectiveNamespace

private java.lang.String m_effectiveNamespace
Effective namespace overriding the target namespace (null if unused).


m_version

private java.lang.String m_version
'version' attribute value.


m_resolver

private ISchemaResolver m_resolver
Resolver for this schema.


m_register

private NameRegister m_register
Register for names from this context.

Constructor Detail

SchemaElement

public SchemaElement()
Constructor.

Method Detail

preset

protected void preset(IUnmarshallingContext ictx)
               throws JiBXException
Description copied from class: SchemaBase
Pre-set method to be called by data binding while parsing element start tag. The base class implementation just sets the parent element link and reads in any extra namespaces defined on the element. Subclasses which override this implementation must call the base implementation during their processing.

Overrides:
preset in class SchemaBase
Parameters:
ictx - unmarshalling context
Throws:
JiBXException - on error

getSchemaChildren

public FilteredSegmentList getSchemaChildren()
Get list of schema-related child elements.

Returns:
child list

getTopLevelChildren

public FilteredSegmentList getTopLevelChildren()
Get list of top-level definition child elements.

Returns:
child list

getAttributeFormDefault

public int getAttributeFormDefault()
Get 'attributeFormDefault' attribute type code.

Returns:
type

setAttributeFormDefault

public void setAttributeFormDefault(int type)
Set 'attributeFormDefault' attribute type code.

Parameters:
type -

getAttributeFormDefaultText

public java.lang.String getAttributeFormDefaultText()
Get 'attributeFormDefault' attribute text.

Returns:
text (null if not set)

setAttributeFormDefaultText

private void setAttributeFormDefaultText(java.lang.String text,
                                         IUnmarshallingContext ictx)
Set 'attributeFormDefault' attribute text. This method is provided only for use when unmarshalling.

Parameters:
text -
ictx -

getElementFormDefault

public int getElementFormDefault()
Get 'elementFormDefault' attribute type code.

Returns:
type

setElementFormDefault

public void setElementFormDefault(int type)
Set 'elementFormDefault' attribute type code.

Parameters:
type -

getElementFormDefaultText

public java.lang.String getElementFormDefaultText()
Get 'elementFormDefault' attribute text.

Returns:
text (null if not set)

setElementFormDefaultText

private void setElementFormDefaultText(java.lang.String text,
                                       IUnmarshallingContext ictx)
Set 'elementFormDefault' attribute text. This method is provided only for use when unmarshalling.

Parameters:
text -
ictx -

getBlock

public AllEnumSet getBlock()
Get 'blockDefault' attribute.

Returns:
block default

getFinal

public AllEnumSet getFinal()
Get 'finalDefault' attribute.

Returns:
final default

getTargetNamespace

public java.lang.String getTargetNamespace()
Get 'targetNamespace' attribute. Note that for most purposes the getEffectiveNamespace() method should be used instead, since that method returns the namespace which should be used for definitions within this schema.

Returns:
target namespace (null if none)

setTargetNamespace

public void setTargetNamespace(java.lang.String tns)
Set 'targetNamespace' attribute.

Parameters:
tns - target namespace (null if none)

getEffectiveNamespace

public java.lang.String getEffectiveNamespace()
Get the effective namespace which applies to this schema. This will differ from the 'targetNamespace' attribute in the case where a no-namespace schema is included (directly or indirectly) into a namespaced schema.

Returns:
effective namespace (null if none)

setEffectiveNamespace

public void setEffectiveNamespace(java.lang.String ens)
Set the effective namespace to be applied to this schema.

Parameters:
ens - effective namespace (null if the same as 'targetNamespace' attribute)

getVersion

public java.lang.String getVersion()
Get 'version' attribute.

Returns:
version

setVersion

public void setVersion(java.lang.String version)
Set 'version' attribute.

Parameters:
version -

getResolver

public ISchemaResolver getResolver()
Get resolver.

Returns:
resolver

setResolver

public void setResolver(ISchemaResolver resolver)
Set resolver.

Parameters:
resolver -

getRegister

public NameRegister getRegister()
Get register for named components of schema.

Returns:
register

isElementQualifiedDefault

public boolean isElementQualifiedDefault()
Check if elements are qualified by default.

Returns:
true if qualified, false if not

isAttributeQualifiedDefault

public boolean isAttributeQualifiedDefault()
Check if attributes are qualified by default.

Returns:
true if qualified, false if not

getName

private java.lang.String getName()
Get the schema name for logging validation.

Returns:
name

validate

public void validate(ValidationContext vctx)
Description copied from class: SchemaBase
Validate component information. The validation step is used for checking the interactions between components, such as name references to other components. The SchemaBase.prevalidate(org.jibx.schema.validation.ValidationContext) method will always be called for every component in the schema definition before this method is called for any component. This empty base class implementation should be overridden by each subclass that requires validation handling.

Specified by:
validate in interface IComponent
Overrides:
validate in class SchemaBase
Parameters:
vctx - validation context

prevalidate

public void prevalidate(ValidationContext vctx)
Description copied from class: SchemaBase
Prevalidate component information. The prevalidation step is used to check isolated aspects of a component, such as the settings for enumerated values. This empty base class implementation should be overridden by each subclass that requires prevalidation handling.

Specified by:
prevalidate in interface IComponent
Overrides:
prevalidate in class SchemaBase
Parameters:
vctx - validation context


Project Web Site