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 ArrayListExtra attributes associated with element (lazy create,nullif unused).private LazyListChild element list (lazy create,nullif 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_TYPEFields inherited from interface org.jibx.schema.IComponent
SCHEMA_NAMESPACE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddExtraAttribute(String name, String uri, String value) Add extra attribute.final voidClear extra attribute list.voidCompact the list of child elements.detachChild(int index) Detach child by index.getChild(int index) Get child by index.final intGet count of child elements.Get read-only iterator for child elements.protected final LazyListGet modifiable list of child elements.final ListGet read-only list of extra attributes.protected voidpreget(IMarshallingContext ictx) Pre-get method called during marshalling.replaceChild(int index, SchemaBase repl) Replace child by index.protected voidvalidateAttributes(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,nullif not used) -
m_attributes
Extra attributes associated with element (lazy create,nullif 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:
getChildCountin classSchemaBase- Returns:
- child count
-
getChildIterator
Get read-only iterator for child elements.- Specified by:
getChildIteratorin 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 anullin 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 anynullvalues (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:
pregetin 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
-