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
public abstract class OpenAttrBase extends SchemaBase
Base class for all element structures in schema definition which allow arbitrary attributes from outside the schema namespace.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
-
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 Modifier Constructor Description protectedOpenAttrBase(int type)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExtraAttribute(String name, String uri, String value)Add extra attribute.voidclearExtraAttributes()Clear extra attribute list.voidcompactChildren()Compact the list of child elements.SchemaBasedetachChild(int index)Detach child by index.SchemaBasegetChild(int index)Get child by index.intgetChildCount()Get count of child elements.IteratorgetChildIterator()Get read-only iterator for child elements.protected org.jibx.util.LazyListgetChildrenWritable()Get modifiable list of child elements.ListgetExtraAttributes()Get read-only list of extra attributes.protected voidpreget(org.jibx.runtime.IMarshallingContext ictx)Pre-get method called during marshalling.SchemaBasereplaceChild(int index, SchemaBase repl)Replace child by index.protected voidvalidateAttributes(org.jibx.runtime.IUnmarshallingContext ictx, org.jibx.util.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
-
-
-
-
Method Detail
-
getChildCount
public final int getChildCount()
Get count of child elements.- Specified by:
getChildCountin classSchemaBase- Returns:
- child count
-
getChildIterator
public Iterator getChildIterator()
Get read-only iterator for child elements.- Specified by:
getChildIteratorin classSchemaBase- Returns:
- iterator
-
getChild
public SchemaBase getChild(int index)
Get child by index.- Parameters:
index- Index- Returns:
- child element
-
replaceChild
public SchemaBase replaceChild(int index, SchemaBase repl)
Replace child by index.- Parameters:
index- Indexrepl- replacement element- Returns:
- detached child
-
detachChild
public SchemaBase detachChild(int index)
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- 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
protected void preget(org.jibx.runtime.IMarshallingContext ictx) throws org.jibx.runtime.JiBXExceptionPre-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:
org.jibx.runtime.JiBXException- on marshalling error
-
getChildrenWritable
protected final org.jibx.util.LazyList 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
public final 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
public final void addExtraAttribute(String name, String uri, String value)
Add extra attribute.- Parameters:
name- attribute nameuri- attribute namespace URIvalue- attribute value
-
validateAttributes
protected void validateAttributes(org.jibx.runtime.IUnmarshallingContext ictx, org.jibx.util.StringArray attrs) throws org.jibx.runtime.JiBXExceptionValidate 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:
org.jibx.runtime.JiBXException- on unmarshalling error
-
-