Package org.jibx.schema.elements
Class OpenAttrBase
java.lang.Object
org.jibx.schema.elements.SchemaBase
org.jibx.schema.elements.OpenAttrBase
- All Implemented Interfaces:
IComponent
- Direct Known Subclasses:
AnnotatedBase
,AnnotationElement
,SchemaElement
Base class for all element structures in schema definition which allow
arbitrary attributes from outside the schema namespace.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ArrayList
Extra attributes associated with element (lazy create,null
if unused).private LazyList
Child element list (lazy create,null
if not used)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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addExtraAttribute
(String name, String uri, String value) Add extra attribute.final void
Clear extra attribute list.void
Compact the list of child elements.detachChild
(int index) Detach child by index.getChild
(int index) Get child by index.final int
Get count of child elements.Get read-only iterator for child elements.protected final LazyList
Get modifiable list of child elements.final List
Get read-only list of extra attributes.protected void
preget
(IMarshallingContext ictx) Pre-get method called during marshalling.replaceChild
(int index, SchemaBase repl) Replace child by index.protected void
validateAttributes
(IUnmarshallingContext ictx, StringArray attrs) Validate attributes of element from schema namespace.Methods inherited from class org.jibx.schema.elements.SchemaBase
addNamespaceDeclaration, bit, clearNamespaceDeclarations, getExtension, getNamespaceDeclarations, getParent, getSchema, isGlobal, name, preset, prevalidate, readNamespaces, setExtension, setParent, type, validate, validateAttributes, writeNamespaces
-
Field Details
-
m_children
Child element list (lazy create,null
if not used) -
m_attributes
Extra attributes associated with element (lazy create,null
if unused).
-
-
Constructor Details
-
OpenAttrBase
protected OpenAttrBase(int type) Constructor.- Parameters:
type
- element type
-
-
Method Details
-
getChildCount
public final int getChildCount()Get count of child elements.- Specified by:
getChildCount
in classSchemaBase
- Returns:
- child count
-
getChildIterator
Get read-only iterator for child elements.- Specified by:
getChildIterator
in classSchemaBase
- Returns:
- iterator
-
getChild
Get child by index.- Parameters:
index
-- Returns:
- child element
-
replaceChild
Replace child by index.- Parameters:
index
-repl
- replacement element- Returns:
- detached child
-
detachChild
Detach child by index. This method only replaces the child with anull
in the child list, leaving the list in an illegal state for most purposes. After using this method,compactChildren()
must be called to remove thenull
(s) from the list and restore it to a legal state. These methods are provided to avoid the overhead otherwise associated with multiple removals from a list.- Parameters:
index
-- Returns:
- detached child
-
compactChildren
public void compactChildren()Compact the list of child elements. This removes anynull
values (which should only be present ifdetachChild(int)
was called) from the list. -
preget
Pre-get method called during marshalling. This first calls the base class implementation to handle namespaces, then writes any extra attributes to the element start tag.- Overrides:
preget
in classSchemaBase
- Parameters:
ictx
- marshalling context- Throws:
JiBXException
- on marshalling error
-
getChildrenWritable
Get modifiable list of child elements. This method should only be used by subclasses to work with their own list of child elements.- Returns:
- child list
-
getExtraAttributes
Get read-only list of extra attributes. Entries in this list are triplets, consisting of attribute name, namespace, and value.- Returns:
- extra attribute list
-
clearExtraAttributes
public final void clearExtraAttributes()Clear extra attribute list. -
addExtraAttribute
Add extra attribute.- Parameters:
name
- attribute nameuri
- attribute namespace URIvalue
- attribute value
-
validateAttributes
protected void validateAttributes(IUnmarshallingContext ictx, StringArray attrs) throws JiBXException Validate attributes of element from schema namespace. This allows any number of attributes from other namespaces on the element.- Parameters:
ictx
- unmarshalling contextattrs
- attributes array- Throws:
JiBXException
- on unmarshalling error
-