public interface XmlDataCursor
XmlData
.
There is only one implementation of this interface.
The XmlData concrete class is used to obtain an XmlDataCursor on an IData object containing an XmlData infoset.
This is accomplished using XmlData.getXmlDataCursor(IData)
.
Within a Java application, all manipulation of the XmlData infoset should be accomplished using either this class, the XmlDataTreeCursor
class, the
static methods of the XmlData
class, or one the helper classes
such as XmlDataMap
or XmlDataCopy
. Direct manipulation of the XmlData infoset using raw IDataCursors is strongly discouraged, as it may make
applications vulnerable to future changes in the XmlData infoset necessitated by enhancements or bug fixes.
Retrieving and updating the content of XmlData infoset is very similar to that of the legacy approach using navigation methods such as first() and next() and using accessor methods such as getValue() and setValue(). Just as with the IDataCursor, the XmlDataCursor must be positioned on the tag corresponding to the element whose value is to be retrieved or modified. However, navigation using XnlDataCursor is much more structured and constrained than using the legacy IDataCursor.
Attributes are also accessed through the XmlDataCursor. However, unlike the legacy IData structure, XmlData stores attributes separately from
the child element content. The attributes are not accessible as "peers" of the child elements and are not accessed using cursor navigation of the children. Instead, there are explicit methods
such as getAttributeValue(XmlDataAttributeTag, int...)
that access the attribute by name (rather than cursor position).
This is consistent with the definition of the XML infoset which asserts that attributes are unique and not ordered for any given element.
There are two varieties of the XmlData infoset. The conforming-XmlData-infoset variation has a format that conforms to a collection of XmlData document types that were created from an XML schema. These conforming XmlData infosets have special constructs (and corresponding special tags) that represent repeating model groups, any wildcards, and substitution groups. The nonconforming-XmlData-infosets have only element tags and attribute tags.
XmlDataElementTag
. The cursor methods accept the parsed-tag format created by those constructors.
In addition, there are static methods in XmlDataConstants
that serve as short-cuts for these methods and can be conveniently
"added" to any code simply by importing all static members of that class. These short-cuts are meant to reduce the syntactic overhead of using formal tag constructors.
The association between tag-type, appropriate constructor, and short-cut is:
XmlData tag type | Role | Constructor | XmlDataConstants short cut |
---|---|---|---|
element-tag | Corresponds to:
|
XmlDataElementTag |
eTag() |
group-tag | Corresponds to a group model in a schema when using a conforming-XmlData-infoset | XmlDataGroupTag |
gTag() |
any-tag | Corresponds to an any wildcard particle in a schema when using a conforming-XmlData-infoset | XmlDataAnyTag |
anyTag() |
substitution-tag | Corresponds to an element particle that is also the head of a substitution group in a schema group model when using a conforming-XmlData-infoset | XmlDataSubstitutionTag |
sTag() |
attribute-tag |
Corresponds to:
|
XmlDataAttributeTag |
aTag() |
The "object" methods are used to access the complete Java object associated with a tag. When repeating values are not present, the object is simply an individual item (value or indirect-item). When repeating values are present, the object is an array of items (an array of values or an array of indirect-items). Thus, methods like getObject() and setObject() allow the entire collection of items to be accessed in a single operation. The items are either direct representations of a value (simple-value, group-value, or complex-value) or an indirect-value (any-items or substitution-items). The tags and object must be compatible. An element-tag must be paired with a value (simple-value, group-value, or complex-value). A group-tag must be paired with a group-value or an array of group-values. An any-tag is always paired with an any-value or an array of anny-values, a substitution-tag is always paired with a substitution-item or an array of substitution-items.
The "item" methods are similar to the "object" methods but include an index qualifier. The "item" methods therefore are used to access a single item if the object contains repeating values. When repeating values are not present, the "item" methods (without an index qualifier) and the "object" methods are equivalent. Simple-values, group-values, and complex-values are directly paired with their tag, while indirect-items (any-items and substitution-items) have their value-tag embedded in the indirect-item.
The "value" methods (e.g., getValue() and setValue()) are the most natural way of accessing the XmlData infoset and are most typically used. An application positions to a particular tag using a method such as first() or next(), and then uses getValue() to obtain the effective value stored at the tag or setValue() to set the value stored at the tag. When positioned on element-tags or group-tags, the "value" methods directly access the values stored at the tag (and operate exactly like the "item" methods). When positioned on any-tags or substitution-tags, the "value" methods transparently access the values stored in indirect-items (substitution-items and any-items) so that the application does not concern itself with the format of values stored as indirect-items.
Even when using the "value" methods, there is still complexity because the value may be a simple-value, a group-value, or
complex-value with or without attributes. The content methods,
getContent(int...)
and setContent(Object, int...)
give direct access to the simple or complex content
regardless of the presence or absence of attributes. In similar fashion, the getAttributes(), setAttributes(), and setAttributeValue() methods
allow direct access to the attribute regardless of the absence or presence of content, or whether the value is an indirect-item.
The getTag()
method returns the tag associated with the current cursor position. However, when using element wildcard (any) or substitution groups, the current tag is a
specialized tag (e.g. an any-tag or an substitution-tag, not the actual XML element name as present
in the instance data. In order to access the actual tag, the getValueTag(int...)
and
setValueTag(XmlDataContentTag, int...)
methods are used. These methods extract the tag from the specialized any-item or
substitution-item structure. For normal
element tags, getValueTag() and setValueTag() behave exactly like getTag() and setTag().
getNamespaceDecl(String, int...)
,
setNamespaceDecl(String, String, int...)
, getInstanceProp(String, int...)
, and setInstanceProp(String, String, int...)
.
Methods | Operation |
---|---|
getObject() , setObject() ,
deleteObject() ,
insertObjectBefore() , insertObjectAFter()
getTag() , setTag()
|
Get or set the entire object at the current position which might be a single item or an array of repeating items |
getItem() , setItem() ,
deleteItem() ,
insertItemAfter() , insertItemBefore() |
Get or set an individual item. For non-repeating values, theses methods operate like getObject() and setObject() and return the item at the current cursor position. When repeating values are present, an index is required to select one item from the object array. The item may be a simple-value, group-value, complex-value, or indirect-item. |
getValue() , setValue()
getValueTag() , setValueTag() ,
insertValueAfter() , insertValueBefore() ,
getValueTag() , setValueTag()
getComplexValueContent() , setComplexValueContent() ,
getContent() ,
setContent() , isEmpty() ,
isSimpleValue() , isGroupValue() , isComplexValue()
|
Get or set an individual value. If repeating values are present, an index must be specified. When the current-tag is an element-tags or group-tag, these methods behave exactly like getItem() and setItem(). For indirect-tags (substitution-tags and any-tags), the value of the indirect-item is accessed. For an any-item, this is the value stored at the *value field in the any-item. For substitution-items it is the value of the first and only child of the substitution-item. There is no deleteValue() method because deleteItem() has the same effect. For non indirect-items, insertItemBefore() and insertValueBefore() operate identically, as do insertValueAfter() and insertItemAfter(). |
getAttributes() , setAttributes() ,
getAttributeValue() , setAttributeValue() ,
hasAttributes() , getAttributeNames() ,
removeAttribute()
|
Get or set attributes values. If the cursor is positioned on an object with repeating values, an index is required. |
first() , next() , previous() ,
firstPartial() , nextPartial() ,
previousPartial() , lastPartial()
|
Reposition the cursor. |
getNamespaceDecl , setNamespaceDecl() ,
getNamespaceDecls() , setNamespaceDecls() ,
getUnstanceProp() , setInstanceProp()
|
Get or set namespace declarations and xsi instance properties. |
count() , isRepeating() , isAny() ,
isSubstitution() , isGroup() ,
recast() , isRecast() , data() , copyCursor() , destroy() , valueCursor()
|
Utility. |
XmlDataException.UnpositionedCursor
exception is thrown if the cursor is not positioned.
XmlData
Modifier and Type | Method and Description |
---|---|
XmlDataCursor |
copyCursor() |
int |
count()
Returns the number of items stored at the current cursor position.
|
IData |
data()
Returns the IData for which this cursor is defined.
|
boolean |
deleteItem(int... index)
Removes a single item from the array of items stored at the current cursor position.
|
boolean |
deleteObject()
Removes the tag-object-pair (single value or array of repeating values) from the current position.
|
void |
destroy()
Release any resources associated with the current cursor.
|
boolean |
first()
Positions the cursor at the first tag-object-pair.
|
boolean |
first(XmlDataContentTag tag)
Positions the cursor on the first tag-object-pair with the specified tag and returns true.
|
boolean |
firstPartial(XmlDataContentTag tag)
Positions the cursor on the first tag-object-pair with a tag that partially matches the specified tag.
|
XmlDataContentTag |
getAnyTag(int... index)
Returns a parsed-tag constructed from the *ncName and *namespace fields in the any-item.
|
XmlDataAttributeTag[] |
getAttributeNames(int... index)
Returns a list of attribute-tags for a complex-value stored at the current cursor position.
|
IData |
getAttributes(int... index)
Returns an IData list of attributes and values for the complex-value stored at the current cursor position.
|
java.lang.String |
getAttributeValue(XmlDataAttributeTag attribute,
int... index)
Returns the value of an attribute for the complex-value at the current cursor position.
|
java.lang.Object |
getComplexValueContent(int... index)
Returns the value paired with the *simple field or the solitary top-level group-tag.
|
java.lang.Object |
getContent(int... index)
Returns the content of the current value.
|
java.lang.String |
getInstanceProp(java.lang.String name,
int... optionalIndex)
Retrieves the value of an instance (xsi) attribute specified for the current value.
|
java.lang.Object |
getItem(int... index)
Returns an item from the current-object.
|
java.lang.String |
getNamespaceDecl(java.lang.String prefix,
int... optionalIndex)
Returns the the namespace URI associated with the specified prefix.
|
IData |
getNamespaceDecls(int... optionalIndex)
Gets all of the namespace-prefix associations for the current value.
|
java.lang.Object |
getObject()
Returns the current-object, the object stored at the current-position.
|
XmlDataContentTag |
getTag()
Returns the current-tag as a parsed-tag.
|
java.lang.Object |
getValue(int... index)
Returns a value from the current-object.
|
XmlDataCursor |
getValueCursor(int... optionalIndex)
Returns an XmlDataCursor positioned on the first child of the specified value in the current-object.
|
XmlDataContentTag |
getValueTag(int... index)
|
boolean |
hasAttributes(int... index)
Determines if the value at the specified index has attributes.
|
void |
home()
The cursor becomes unpositioned as if newly created.
|
void |
insertItemAfter(java.lang.Object item,
int index)
Inserts an item after the specified index into the array of repeating values at the current-position.
|
void |
insertItemBefore(java.lang.Object item,
int index)
Inserts an item before the specified index into the array of repeating values at the current-position.
|
void |
insertObjectAfter(XmlDataContentTag tag,
java.lang.Object object)
Inserts a tag-object-pair after the current-position.
|
void |
insertObjectBefore(XmlDataContentTag tag,
java.lang.Object object)
Inserts a tag-object-pair before the current-position.
|
void |
insertValueAfter(XmlDataContentTag tag,
java.lang.Object value,
int index)
Inserts a value into an array of repeating values at the current-position, after the specified index.
|
void |
insertValueBefore(XmlDataContentTag tag,
java.lang.Object value,
int index)
Inserts a value into an array of repeating values at the current-position, before the specified index.
|
boolean |
isAny()
Determines if the current-tag is an any-tag.
|
boolean |
isComplexValue(int... index)
Determines if the value at the current-position is an IData with a single group tag, an *attribute tga, or a *simple tag.
|
boolean |
isEmpty(int... index)
Determines if the value at the current-position is empty (or non-existent complex content for complex-values).
|
boolean |
isGroup()
Determines if the current-tag is a group-tag.
|
boolean |
isGroupValue(int... index)
Determines if the value at the current-position is a group-value.
|
boolean |
isHome()
Indicates whether the cursor is unpositioned.
|
boolean |
isRecast()
Indicates if automatic recast is in effect.
|
boolean |
isRepeating()
Determines if the current-object is a repeating value.
|
boolean |
isSimpleValue(int... index)
Determines if the value at the current-position is a simple value.
|
boolean |
isSubstitution()
Determines if the current-tag is a substitution-tag
|
boolean |
last()
Positions the cursor at the last tag-object-pair.
|
boolean |
last(XmlDataContentTag tag)
Positions the cursor on the last occurrence of the last tag-object-pairg with the specified tag and return true.
|
boolean |
lastPartial(XmlDataContentTag tag)
Positiosn the cursor on the last tag-object-pair with a tag that partially matches the specified tag.
|
XmlDataCursor |
newCursor(IData data)
Creates a new XmlDataCuror instances from an existing cursor factory.
|
boolean |
next()
Positions the cursor on the next tag-object-pair.
|
boolean |
next(XmlDataContentTag tag)
Positiona the cursor on the next tag-object-pair that has the specified tag and returns true.
|
boolean |
nextPartial(XmlDataContentTag tag)
Positions the cursor on the next tag-object-pair with a tag that partially matches the specified tag.
|
boolean |
previous()
Positions the cursor on the previous tag-object-pair.
|
boolean |
previous(XmlDataContentTag tag)
Positions the cursor on the previous tag-object-pair with the specified tag and return true.
|
boolean |
previousPartial(XmlDataContentTag tag)
Positions the cursor on the previous tag-object-pair with a tag that partially matches the specified tag.
|
void |
recast(boolean mode)
Indicates whether existing String[] or IData[] arrays for repeating values should be automatically recreated as an Object[] when the inserted or set value type doesn't match
the type of the repeating item array that is already present.
|
boolean |
removeAttribute(XmlDataAttributeTag attribute,
int... index)
Removes the specified attribute from an item value stored at the current cursor position.
|
void |
setAnyTag(XmlDataContentTag tag,
int... index)
Sets the *ncName and *namespace fields of an any-item.
|
void |
setAttributes(IData attributes,
int... index)
Sets the attribute-set for the current element
|
void |
setAttributeValue(XmlDataAttributeTag attribute,
java.lang.String value,
int... index)
Sets the value for the specified attribute.
|
void |
setComplexValueContent(java.lang.Object content,
int... index)
Replaces the content of a complex-value at the current-position
while preserving any original associated attributes.
|
void |
setContent(java.lang.Object content,
int... index)
Replaces the content of the value at the current-position.
|
void |
setInstanceProp(java.lang.String name,
java.lang.String value,
int... index)
Sets an XML instance property (xsi attribute) on the current item.
|
void |
setItem(java.lang.Object object,
int... index)
Stores a value or an indirect-item at the current cursor position.
|
void |
setNamespaceDecl(java.lang.String prefix,
java.lang.String uri,
int... index)
Sets a namespace declaration for the current item.
|
void |
setNamespaceDecls(IData nsDecls,
int... optionalIndex)
Sets the namespace declarations for the current item.
|
void |
setObject(java.lang.Object object)
Sets the object stored at the current cursor position ( a value or array of repeating values).
|
void |
setTag(XmlDataContentTag tag)
Sets the tag of the current tag-object pair.
|
void |
setValue(java.lang.Object value,
int... index)
Sets the value at the current cursor position (and index if repeating values are present).
|
void |
setValueTag(XmlDataContentTag tag,
int... index)
Sets the tag of the value stored at the current cursor.
|
XmlDataCursor copyCursor()
int count()
IData data()
boolean deleteItem(int... index)
index
- optional offset (starting at zero) into the array if repeating values presentXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values presentboolean deleteObject()
XmlDataException.UnpositionedCursor
- when cursor is not positionedvoid destroy()
boolean first()
boolean first(XmlDataContentTag tag)
tag
- the searched content-tagboolean firstPartial(XmlDataContentTag tag)
tag
- the searched content-tagXmlDataContentTag getAnyTag(int... index)
XmlDataElementTag
or XmlDataSubstitutionTag
.
This is a very specialized method. More typically, getValueTag(int...)
is used to return the tag associated with the item. However, if the any-item
references a substitution group, the getValueTag() method returns the element tag present in the substitution group. This specialized method returns the
tag created from fields in the any-item which will be either be an element-tag or a substitution-tag.
This method is used only when it is necessary to distinguish between substitution tags and element tags in a any-item document.
Normally, getValueTag(int...)
will be sufficient, and more general.index
- offset into the repeating item array (if repeating values are present)XmlDataException.TagConflict
- if the cursor is not positioned on an any-tag.XmlDataAttributeTag[] getAttributeNames(int... index)
getValue(int...)
was invoked, and then attribute-tags extracted from the result.index
- offset into the repeating value array (if repeating values are present)XmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentIData getAttributes(int... index)
getValue(int...)
was invoked, and then attribute-set
is retrieved from the value.index
- the offset of the item of repeating values are presentjava.lang.String getAttributeValue(XmlDataAttributeTag attribute, int... index)
attribute
- the tag of the attribute XmlDataAttributeTag)index
- offset into the list of repeating values (starting at 0)XmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentjava.lang.Object getContent(int... index)
getComplexValueContent(int...)
is returned. If the complex-value has no content, null is returned; but if the complex-value
can be interpreted as an empty group-value, the empty group is returned (rather than null). If the content is a repeating group, an IData[] is returned.index
- offset into repeating valuesjava.lang.Object getComplexValueContent(int... index)
index
- the index of the repeating value that is a complex-valueXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentXmlDataException.FormatError
- when the current value is not a complex-valuejava.lang.String getInstanceProp(java.lang.String name, int... optionalIndex)
name
- the name of the xsi property (e.g. nil, type)optionalIndex
- offset into the repeating valuesjava.lang.Object getItem(int... index)
index
- offset into the repeating values array (if repeating values are present)java.lang.String getNamespaceDecl(java.lang.String prefix, int... optionalIndex)
prefix
- the prefixoptionalIndex
- the namespace URI associated with the prefixIData getNamespaceDecls(int... optionalIndex)
optionalIndex
- the index of the repeating value for which prefixes are returnedXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed value does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentjava.lang.Object getObject()
XmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataContentTag getTag()
XmlDataElementTag
, an XmlDataAnyTag
, an XmlDataGroupTag
, or an
XmlDataSubstitutionTag
. An exception is thrown if the cursor is not positioned.XmlDataException.UnpositionedCursor
- when the cursor is not positionedjava.lang.Object getValue(int... index)
index
- the offset into repeating valuesXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentXmlData.getAnyItemValueTag(IData)
,
XmlData.getSubstitutionItemValueTag(IData)
XmlDataCursor getValueCursor(int... optionalIndex)
optionalIndex
- the index of the repeating valueXmlDataContentTag getValueTag(int... index)
XmlDataElementTag
or XmlDataGroupTag
).
If the current-tag is an element-tag or a group-tag,
the current-tag is simply returned. The behavior is the same as that of getTag()
.
If the current-tag is an any-tag or a substitution-tag,
an XmlDataElementTag is constructed from the associated indirect-item.index
- the index of the repeating valueXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentXmlData.getAnyItemValueTag(IData)
,
XmlData.getSubstitutionItemValueTag(IData)
boolean hasAttributes(int... index)
index
- the index offset into repeating valuesXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existvoid home()
void insertItemAfter(java.lang.Object item, int index)
XmlData.createSubstitutionItem(XmlDataElementTag, Object)
or XmlData.createAnyItem(XmlDataContentTag, Object)
.
If the current-object is a scalar, it is promoted to an array prior to insertion of the new item. If the cursor has recast set to true, the new array is an Object[].index
- The insert position after which the value is inserteditem
- the scalar value inserted (must be simple-value, group-value, complex-value, or indirect-item)XmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed value does not existXmlDataException.UnsupportedType
- when the inserted value is not an IData or String instanceXmlDataException.TagAndContentConflict
- when the inserted item is incompatible with the current tag (for example inserting a String when
the current tag is a substitution group tag)void insertItemBefore(java.lang.Object item, int index)
XmlData.createSubstitutionItem(XmlDataElementTag, Object)
or XmlData.createAnyItem(XmlDataContentTag, Object)
.
If the current-object is a scalar, it is promoted to an array prior to insertion of the new item. If the cursor has recast set to true, the new array is an Object[].item
- the scalar value inserted (must be simple-value, group-value, complex-value, or indirect-item)index
- the index position before which the value is insertedXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed value does not existXmlDataException.UnsupportedType
- when the inserted value is not an IData or String instanceXmlDataException.TagAndContentConflict
- when the inserted item is incompatible with the current tag (for example inserting a String when
the current tag is a substitution group tag)void insertObjectAfter(XmlDataContentTag tag, java.lang.Object object)
tag
- the tag of the tag/object pair to be inserted before the current cursor positionobject
- the item or array of repeating values that is inserted (must be String, String[], IData, IData[], or Object[])void insertObjectBefore(XmlDataContentTag tag, java.lang.Object object)
tag
- the tag of the tag/object pair to be inserted before the current cursor positionobject
- the item or array of repeating values that is inserted (must be String, String[], IData, IData[], or Object[])void insertValueAfter(XmlDataContentTag tag, java.lang.Object value, int index)
tag
- the name of the repeating value for indirect-items (may be null if current tag is an element and group)value
- the value to insert (if the current tag is an any tag and the content tag is a substitution tag, value must be a substitution value).index
- the index of the repeating itemXmlDataException.TagAndContentConflict
- when the contentTag is inappropriate for the current tag (for a substitution tag,
the content tag should be an XmlDataElementTag, and for an any tag, the content tag should be an
XmDataElementTag or an XmlDataSubstitutionTagvoid insertValueBefore(XmlDataContentTag tag, java.lang.Object value, int index)
tag
- the tag of the value for indirect-items (may be null if current tag is an element and group tag)value
- the value to insert (if the current tag is an any tag and the content tag is a substitution tag, value must be a substitution value).index
- the index of the repeating itemXmlDataException.TagAndContentConflict
- when the contentTag is inappropriate for the current tag (for a substitution tag,
the content tag should be an XmlDataElementTag, and for an any tag, the content tag should be an
XmDataElementTag or an XmlDataSubstitutionTagboolean isAny()
XmlDataException.UnpositionedCursor
- when the cursor is not positionedboolean isComplexValue(int... index)
index
- offset into repeating values.XmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentboolean isEmpty(int... index)
index
- offset into repeating valuesXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentboolean isGroup()
XmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataContentTag.isGroup()
boolean isGroupValue(int... index)
index
- the offset into the repeating values arrayXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentXmlData.isGroupValue(Object)
boolean isHome()
boolean isRecast()
boolean isRepeating()
XmlDataException.UnpositionedCursor
- if the cursor is not positionedboolean isSimpleValue(int... index)
index
- the offset into the repeating values arrayboolean isSubstitution()
XmlDataException.UnpositionedCursor
- when the cursor is not positionedboolean last()
boolean last(XmlDataContentTag tag)
tag
- the searched content-tagboolean lastPartial(XmlDataContentTag tag)
tag
- the XmlDataContentTag to be searchedXmlDataCursor newCursor(IData data)
data
- an existing IData who's cursor factory is used to create a new XmlDataCursor instance.boolean next()
boolean next(XmlDataContentTag tag)
tag
- the searched content-tagboolean nextPartial(XmlDataContentTag tag)
tag
- the searched content-tagboolean previous()
boolean previous(XmlDataContentTag tag)
tag
- the searched content-tagboolean previousPartial(XmlDataContentTag tag)
tag
- the searched content-tagboolean removeAttribute(XmlDataAttributeTag attribute, int... index)
attribute
- an XmlDataAttributeTag naming the attributeindex
- the offset if the element is a repeating valueXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentvoid recast(boolean mode)
mode
- true causes automatic recast; default is falsevoid setAttributes(IData attributes, int... index)
attributes
- IData list of attributesindex
- position in repeating valueXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentvoid setAttributeValue(XmlDataAttributeTag attribute, java.lang.String value, int... index)
attribute
- an XmlDataAttributeTag naming the attributevalue
- the value to set (must be a String)index
- optional offset into array of repeating valuesXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentXmlDataException.UnsupportedType
- when a value other than a String is passedvoid setComplexValueContent(java.lang.Object content, int... index)
content
- the value that replaces the current contentindex
- optional offset when repeating values are present; a second index is required when repeating content is presentXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are present.void setContent(java.lang.Object content, int... index)
setValue(Object, int...)
.
When the accessed value is complex, this method behaves like setComplexValueContent(Object, int...)
.content
- the content of the current valueindex
- the offset into a list of repeating valuesXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are present.void setInstanceProp(java.lang.String name, java.lang.String value, int... index)
name
- the name of the property(e.g. 'nil')value
- the value of the property (e.g. 'true')index
- the offset index into repeating valuesXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are present.void setItem(java.lang.Object object, int... index)
It is always preferable to use one of the XmlData
methods to construct the value if it is not a String or String[]. For example, use
XmlData.createGroupValue(Object...)
if the content does not contain attributes and the top-level group does not contain repeating values. Otherwise
use XmlData.createComplexValue()
. When creating an indirect-item, use a methods such as XmlData.createAnyItem(XmlDataContentTag, Object)
to create an any-item or a method such as XmlData.createSubstitutionItem(XmlDataElementTag, Object)
to create
a substitution-item.
If an index is specified, the specified value in the array of repeating values is set and any associated attributes cleared. When no index is specified, the object must be scalar String or IData object. An index of -1 is equivalent to the index of the last repeating item. It is an error if the value is incompatible with the current-tag. For example, substitution-tags, group-tags, and any-tags only accept an IData as value. If tag and content are not compatible, the TagAndContentConflict exception is thrown.
object
- the value to be replaced.index
- the position in the list of repeating values to be set. When index is specified, the value may not be an array.XmlDataException.UnsupportedType
- when content other than a String or an IData instance is passedXmlDataException.TagAndContentConflict
- when the content is not appropriate for the current tag (for example if the current
tag is an XmlDataSubstitutionTag, then the content must be an IData in *substitution document format).XmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentvoid setNamespaceDecl(java.lang.String prefix, java.lang.String uri, int... index)
prefix
- the prefixuri
- the namespace URI.index
- the offset index into repeating valuesXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentvoid setObject(java.lang.Object object)
object
- the offset to be stored at the current element.XmlDataException.UnpositionedCursor
- when the cursor is not positionedvoid setNamespaceDecls(IData nsDecls, int... optionalIndex)
nsDecls
- IData list of prefix/namespace pairsoptionalIndex
- the index of the repeating itemXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentvoid setAnyTag(XmlDataContentTag tag, int... index)
setValueTag(XmlDataContentTag, int...)
is used.
This method sets the any-item tag directly even if the value of the any-item is a substitution-item.
This method is typically used in conjunction with getAnyTag(int...)
tag
- the tag used to set ncName and namespace in the any-item.index
- offset into list of repeating valuesXmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentvoid setTag(XmlDataContentTag tag)
tag
- is one of the XmlDataContentTags mentioned above.XmlDataException.UnpositionedCursor
- when the cursor is not positionedvoid setValue(java.lang.Object value, int... index)
value
- the IData or String object that ia assigned as the value of the current cursor position.index
- the offset into the repeating values if the current item is an array.XmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values are presentXmlDataException.FormatError
- when the current element's value is not compatible with the current, making it impossible to properly
set the current valuevoid setValueTag(XmlDataContentTag tag, int... index)
setTag(XmlDataContentTag)
. However, if the current value is an indirect-item,
the tag is stored in the indirect-item. If the indirect-item is an any-item, the tag is decomposed and stored
in the *ncName and *namespace fields of the any-item.
The current tag remains unchanged. If the current tag is a substitution-tag, the value tag is stored as the tag of the first and only child in
the substitution-item.
The index parameter only has meaning for substitution and any objects (names of repeated elements and groups are identical for all entries).tag
- the tag assigned to the current valueindex
- the offset into the repeating value array.XmlDataException.UnpositionedCursor
- when the cursor is not positionedXmlDataException.IndexOutOfRange
- when the indexed item does not existXmlDataException.IndexRequired
- when an index is not specified and repeating values presentXmlDataException.FormatError
- when the current element's value is not compatible with the current tag, making it impossible to properly
set the current value