public class XmlDataMap
extends java.lang.Object
getXmlDataCursorAt(XmlDataContentTag)
.Modifier and Type | Method and Description |
---|---|
static XmlDataMap |
create(IData data,
NSRecord record)
Creates an XmlDataMap using the specified input data and NSRecord.
|
boolean |
drop(XmlDataContentTag memberTag,
int... index)
Removes the item at the specified tag and index.
|
boolean |
dropObject(XmlDataContentTag memberTag)
Removes the object at the specified tag.
|
java.lang.Object |
getContent(XmlDataContentTag memberTag,
int... index)
Returns the content at the specified tag as if the
XmlDataCursor.getContent(int...) method was invoked. |
IData |
getData()
Returns the data mapped by this XmlDataMap.
|
XmlNamespaceMap |
getDefaultNamespaceMap()
Gets the default XnlNamespaceMap.
|
NSField |
getDefinedField(XmlDataContentTag tag)
Retrieves the NSField corresponding to the specified tag.
|
NSField |
getField(XmlDataContentTag tag)
Retrieves the NSField corresponding to the specified tag.
|
java.lang.Object |
getItem(java.lang.String path)
Gets the item specified by a String path.
|
java.lang.Object |
getItem(XmlDataContentTag[] tags)
Returns the item specified by a path using a list of XmlDataContentTags.
|
java.lang.Object |
getItem(XmlDataContentTag memberTag,
int... index)
Retrieves a single item stored at the specified tag.
|
java.lang.Object |
getObject(XmlDataContentTag memberTag)
Retrieves the entire object stored at the specified tag.
|
XmlDataContentTag |
getParentTag()
Returns the tag that is currently mapped in the parent.
|
XmlDataContentTag |
getParentValueTag()
Returns the tag associated with the currently mapped parent.
|
XmlDataContentTag[] |
getPath()
Creates an XmlData path (an array of XmlDataContentTags) from the current map.
|
java.lang.String |
getPathAsString()
Returns the path as a String using the default namespace map.
|
java.lang.String |
getPathAsStringWithMap()
Returns part as a String (including the namespace prefixes) using the default Namespace map.
|
java.lang.Object |
getValue(java.lang.String path)
Gets the value of an item specified using a String path.
|
java.lang.Object |
getValue(XmlDataContentTag[] tags)
Gets the value of an item using a list of XmlDataContentTags as the path.
|
java.lang.Object |
getValue(XmlDataContentTag memberTag,
int... index)
Returns the value at the specified tag.
|
XmlDataContentTag |
getValueTag(XmlDataContentTag memberTag,
int... index)
Retrieves the value-tag from the item with the specified tag.
|
XmlDataCursor |
getXmlDataCursorAt(XmlDataContentTag memberTag)
Returns an XmlDataCursor positioned on the specified tag.
|
void |
insertItemAfter(XmlDataContentTag memberTag,
java.lang.Object item,
int index)
Inserts an item into the repeating value list at the specified tag.
|
void |
insertItemBefore(XmlDataContentTag memberTag,
java.lang.Object item,
int index)
Inserts an item into a repeating value list at the specified tag.
|
void |
insertValueAndTagAfter(XmlDataContentTag memberTag,
XmlDataElementTag valueTag,
java.lang.Object value,
int index)
Inserts a value and value-tag into a repeating value list at the specified tag,
If the specified tag is an any-tag or
a substitution-tag, the appropriate indirect-item
is created from the value and value-tag and inserted into the array at the specified tag and index.
|
void |
insertValueAndTagBefore(XmlDataContentTag memberTag,
XmlDataElementTag valueTag,
java.lang.Object value,
int index)
|
boolean |
isChildMapable(XmlDataContentTag memberTag)
Indicates whether the specified field is mappable.
|
int |
map(java.lang.String path)
Performs a nested map by navigating from the current map to the specified child along a path specified by a String.
|
int |
map(XmlDataContentTag[] tags)
Performs a nested map for each tag in the list, effectively navigating to a lower level in the tree.
|
boolean |
map(XmlDataContentTag memberTag,
int... index)
Creates a new XmlDataMap of the specified child, pushing the current map onto an internal stack.
|
boolean |
map(XmlDataContentTag memberTag,
XmlDataContentTag qualifierTag,
int... index)
Creates a new XmlDataMap of the specified child (memberTag), pushing the current map onto an internal stack.
|
int |
mapExisting(boolean allowPartial,
java.lang.String path)
Only maps a field that exists in the instance.
|
int |
mapExisting(boolean allowPartial,
XmlDataContentTag[] tags)
Performs a nested map for each tag in the list, effectively navigating to a lower level in the tree.
|
boolean |
mapExisting(XmlDataContentTag memberTag,
int... index)
Performs a map of the specified tag and index if it exists.
|
boolean |
mapExisting(XmlDataContentTag memberTag,
XmlDataContentTag qualifierTag,
int... index)
Performs a map of the specified tag, index, and indirect-qualifier.
|
boolean |
parent(int... num)
Returns to a parent map by popping the current XMlDataMap from the internal stack.
|
void |
setDefaultNamespaceMap(java.lang.String pairs)
Sets the namespace map used to resolve namespace-qualified String paths.
|
void |
setDefaultNamespaceMap(XmlNamespaceMap map)
Sets the namespace map used by namespace-qualified String paths.
|
void |
setItem(java.lang.String path,
java.lang.Object value)
Performs a setItem() of formatted value by navigating from the current map to the specified child along a path specified by a String.
|
void |
setItem(XmlDataContentTag[] tags,
java.lang.Object value)
Performs a setItem() of a formatted value by navigating from the current map to the specified child along a path specified by a list of content tags.
|
void |
setItem(XmlDataContentTag memberTag,
java.lang.Object value,
int... index)
Sets the item associated with the specified member tag.
|
void |
setObject(XmlDataContentTag memberTag,
java.lang.Object obj)
Sets the object at the specified tag.
|
void |
setValue(java.lang.String path,
java.lang.Object value)
Performs a
setValue() by navigating from the current map to the specified child along a
map-path specified as a String. |
void |
setValue(XmlDataContentTag[] tags,
java.lang.Object value)
Performs a
setValue() by navigating from the current map to the specified child along a
map-path specified by a list of content-tags. |
void |
setValue(XmlDataContentTag memberTag,
java.lang.Object value,
int... index)
Sets the value stored at the specified tag.
|
void |
setValueAndTag(XmlDataContentTag memberTag,
XmlDataContentTag valueTag,
java.lang.Object value,
int... index)
Sets the value and value-tag of the specified indirect-item.
|
void |
setValueTag(XmlDataContentTag memberTag,
XmlDataElementTag valueTag,
int... index)
Sets the value-tag of the specified indirect-item.
|
public static XmlDataMap create(IData data, NSRecord record)
data
- an IData in XmlData formatrecord
- an NSRecordXmlDataException.ImproperDocumentType
- the NSRecord is not an XmlData record or does not content any contentpublic boolean drop(XmlDataContentTag memberTag, int... index)
memberTag
- the content-tag to be removedindex
- the offset into repeating values. If the last repeating value is removed, the entire entry (including the tag) is removed.XmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordpublic boolean dropObject(XmlDataContentTag memberTag)
memberTag
- the content-tag of the item to be removedXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordpublic java.lang.Object getItem(XmlDataContentTag memberTag, int... index)
getValue(XmlDataContentTag, int...)
method to obtain the value of an indirect-item.memberTag
- the tag for which data is retrieved. This must be an element-tag,
a substitution-tag, an any-tag, or a group-tag.index
- the index if repeating items are presentXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordpublic java.lang.Object getItem(XmlDataContentTag[] tags)
tags
- the list of XmlDataContentTagspublic java.lang.Object getItem(java.lang.String path)
path
- the pathpublic java.lang.Object getContent(XmlDataContentTag memberTag, int... index)
XmlDataCursor.getContent(int...)
method was invoked. For complex-values,
content does not include attributes.memberTag
- the tag of the member item for which content is returnedindex
- the offset into the list of repeating valuesXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordXmlDataException.FormatError
- when the value is not in complex-value formatpublic IData getData()
public XmlNamespaceMap getDefaultNamespaceMap()
public NSField getDefinedField(XmlDataContentTag tag)
tag
- the XmlDataContentTag identifying the NSField to retrievepublic NSField getField(XmlDataContentTag tag)
tag
- the XmlDataContentTag identifying the NSField to retrieveXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordpublic XmlDataContentTag getParentValueTag()
public XmlDataContentTag getParentTag()
public java.lang.Object getObject(XmlDataContentTag memberTag)
memberTag
- the tag for which data is retrieved. This must be an element-tag, a substitution-tag,
an any-tag, or a group-tag.XmlDataException.UnknownField
- the specified tag is not defined in the mapping recordpublic XmlDataContentTag[] getPath()
public java.lang.String getPathAsString()
public java.lang.String getPathAsStringWithMap()
public java.lang.Object getValue(XmlDataContentTag memberTag, int... index)
memberTag
- the tag for which the value is returned.index
- the offset into the list of repeating values.XmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordpublic java.lang.Object getValue(XmlDataContentTag[] tags)
tags
- the list of XmlDataContentTagspublic java.lang.Object getValue(java.lang.String path)
path
- the patchpublic XmlDataContentTag getValueTag(XmlDataContentTag memberTag, int... index)
memberTag
- the content-tag for which the search is performedindex
- the offset into the list of repeating valuesXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- when the the specified tag is not defined in the mapping recordpublic XmlDataCursor getXmlDataCursorAt(XmlDataContentTag memberTag)
memberTag
- the XmlDataContentTagpublic void insertItemAfter(XmlDataContentTag memberTag, java.lang.Object item, int index)
memberTag
- the tag at which a repeating value is inserteditem
- the item that is insertedindex
- the offset into the repeating values listXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- if the specified field is not defined in the current map.public void insertItemBefore(XmlDataContentTag memberTag, java.lang.Object item, int index)
memberTag
- the tag at which a repeating value is inserteditem
- the item that is insertedindex
- the offset into the listXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- if the specified field is not defined in the current mappublic void insertValueAndTagAfter(XmlDataContentTag memberTag, XmlDataElementTag valueTag, java.lang.Object value, int index)
memberTag
- the tag for which a repeating value is insertedvalue
- the value insertedvalueTag
- the tag of the valueindex
- the offset into the repeating value listXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- the specified tag is not defined in the mapping recordpublic void insertValueAndTagBefore(XmlDataContentTag memberTag, XmlDataElementTag valueTag, java.lang.Object value, int index)
memberTag
- the tag for which a repeating value is insertedvalueTag
- the tag of the valuevalue
- the value insertedindex
- the offset into the list of repeating valuesXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordpublic boolean isChildMapable(XmlDataContentTag memberTag)
memberTag
- the tag to be testedXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordpublic boolean map(XmlDataContentTag memberTag, int... index)
memberTag
- the tag of the child that is mappedindex
- the offset into repeating child values; if the content tgg has an index, this value overrides it.XmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordXmlDataException.ImproperDocumentType
- the NSRecord is not an XmlData record or does not content any contentpublic boolean map(XmlDataContentTag memberTag, XmlDataContentTag qualifierTag, int... index)
memberTag
- the tag of the child that is mappedqualifierTag
- the indirect-qualifier for the indirect-itemindex
- the offset into repeating child values; if the content tag has an index, this value overrides ittrue
if the mapped child already exists in the pipeline, false
if it has not yet been createdpublic int map(XmlDataContentTag[] tags)
tags
- a list of XmlDataContentTagspublic int map(java.lang.String path)
path
- the path specified as a StringXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordXmlDataException.ImproperDocumentType
- the NSRecord is not an XmlData record or does not content any contentpublic boolean mapExisting(XmlDataContentTag memberTag, int... index)
memberTag
- the tag to mapindex
- the offset into the list if repeating valuesXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordXmlDataException.ImproperDocumentType
- the NSRecord is not an XmlData record or does not content any contentpublic boolean mapExisting(XmlDataContentTag memberTag, XmlDataContentTag qualifierTag, int... index)
memberTag
- the tag to mapqualifierTag
- the indirect-qualifierindex
- the indexpublic int mapExisting(boolean allowPartial, XmlDataContentTag[] tags)
tags
- a list of XmlDataContentTagsallowPartial
- a value of true indicates that mapping may succeed if part of the path exists. A value of false indicates that entire path must existXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordXmlDataException.ImproperDocumentType
- the NSRecord is not an XmlData record or does not content any contentpublic int mapExisting(boolean allowPartial, java.lang.String path)
mapExisting(boolean, XmlDataContentTag[])
but allows the path
to be expressed in String form.allowPartial
- indicates that a partially existing path is acceptablepath
- the path expressed as a Stringpublic boolean parent(int... num)
num
- the number of levels to pop. The default is 1.public void setItem(XmlDataContentTag memberTag, java.lang.Object value, int... index)
XmlData.createSubstitutionItem(XmlDataElementTag, Object)
.
For any-tags, the value must be an any-item, such as the object constructed using the
convenience method XmlData.createAnyItem(XmlDataContentTag, Object)
.memberTag
- the tag for which a formatted values is setvalue
- the formatted value assigned (must match the tag usage)index
- offset into the repeating value listXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordpublic void setItem(XmlDataContentTag[] tags, java.lang.Object value)
tags
- the list of tags that defines the path to the item that is setvalue
- the formatted value that is setpublic void setItem(java.lang.String path, java.lang.Object value)
path
- the String form of the path to the item that is setvalue
- the formatted value that is setpublic void setDefaultNamespaceMap(XmlNamespaceMap map)
map
- the XmlNamespace mappublic void setDefaultNamespaceMap(java.lang.String pairs)
pairs
- a String in the form "prefix1 namespace1 prefix2 namespace2 ..."public void setObject(XmlDataContentTag memberTag, java.lang.Object obj)
memberTag
- the tag for which the value is set. For group-tags, any-tags,
and substitution-tags, the content must be IData
or IData[]. For element-tags, the content may be String, String[], IData, IData[], or Object[].obj
- the object stored at the tagXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordpublic void setValue(XmlDataContentTag memberTag, java.lang.Object value, int... index)
memberTag
- the tag whose value is setvalue
- the single value stored at the tagindex
- offset into the repeating value listXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.FormatError
- if the value does not exist (unless it can be constructed from an indirect-qualifier tag)XmlDataException.UnknownField
- when the specified field is not defined in the mapping record.public void setValue(XmlDataContentTag[] tags, java.lang.Object value)
setValue()
by navigating from the current map to the specified child along a
map-path specified by a list of content-tags. If any of the tags
correspond to repeating values, an indexed form of the content-tag must be used.tags
- path expressed as an array of tagsvalue
- the value to be setpublic void setValue(java.lang.String path, java.lang.Object value)
setValue()
by navigating from the current map to the specified child along a
map-path specified as a String. If any of the tags
correspond to repeating values, an indexed form of the path String must be used. If the path string uses namespace-qualified tags, the path must include
the { ... } namespace preamble, or the default namespace may must be set using the setDefaultNamespaceMap.path
- path expressed as Stringvalue
- the value to be setpublic void setValueAndTag(XmlDataContentTag memberTag, XmlDataContentTag valueTag, java.lang.Object value, int... index)
memberTag
- the indirect-tag of the item for which the value and value-tag is setvalueTag
- the value-tag that is set for the indirect-itemvalue
- value assigned to the indirect-itemindex
- index into repeating valueXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordXmlDataException.TagConflict
- when invoked on anything other than an XmlDataSubstitutionTag or XmlDataAnyTagpublic void setValueTag(XmlDataContentTag memberTag, XmlDataElementTag valueTag, int... index)
memberTag
- the indirect-tag of the item whose value-tag is changedvalueTag
- the new value-tagindex
- offset into repeating valuesXmlDataException.IndexOutOfRange
- when the index exceeds the number of repeating elements or the maxOccurs of the mapped fieldXmlDataException.UnknownField
- when the specified tag is not defined in the mapping recordXmlDataException.TagConflict
- when invoked on anything other than an XmlDataSubstitutionTag or XmlDataAnyTag