public class XmlData
extends java.lang.Object
As a rule, do not intermix the XMLData and legacy formats. This applies to both instance data and document types. The XmlData infoset format should not reference the legacy infoset format. The legacy infoset XML format should not reference the XmlData infoset format. The two formats should not be mixed because they represent tags using completely different and incompatible techniques. The XmlData infoset format supports XML schema features not supported by the legacy format. This support includes repeating model groups, substitution groups, and 'any' wildcards. Most of the built-in services will not operate properly with intermixed representations. However, either or both types of formats can be referenced from an IData that does not represent XML encoded data (for example an Integration Server pipeline variable).
The encoding format conforms to the format of the new XmlData document types, though it is possible to use XmlData without document types. XmlData does not operate with legacy document types created from schemas. The new XmlData document types more fully represent the capabilities of XML and XML Schema. When conforming document types are not used, a slightly simpler infoset encoding format is used.
The new XmlData format is created from XML and converted back to XML using new services in the pub.xmldata folder of the WmPublic package. This makes it possible for Flow Map manipulation of the XmlData format to be very similar to the legacy format.
Within a Java application, all manipulation of the XmlData infoset should be accomplished using this class, XmlDataCursor
, XmlDataTreeCursor
, or one the helper classes
such as XmlDataMap
or XmlDataCopy
. Direct manipulation of the XmlData infoset using raw IData methods is strongly discouraged, as it may make
applications vulnerable to future changes in the XmlData infoset necessitated by enhancements or bug fixes.
A simple-value is represented as a Java String. It represents a schema simpleType and, as such, has no sub-components; it stands alone.
A group-value is an IData collection of tag-object-pairs. Group-values correspond roughly to schema model groups. The tags correspond to element tags in the source and the paired objects represent content and may be simple-values, group-values, complex-values, indirect-items, or arrays of them. When a schema complexType has no attributes and no repeating top-level group, it is represented as a group-value. This simplifies the presentation of such complexTypes by removing the clutter of unnecessary *attributes fields and group-tags that are present in a complex-value.
Complex-values are specialized IData structures that are used if schema complexTypes have attributes or repeating top-level groups. They may have a *attributes field paired with an attribute-set and they may also have a content-pair. The content-pair may be simple-value paired with a *simple tag or or a group-value paired with a group-tag. When the content is a simple-value, it corresponds to the schema simpleContent of a complexType. When the content is a group-value, it corresponds to the top-level group of schema complexType with complexContent. Just as with a schema top-level group, the group-value may be repeating. To simplify document type rendering, a complexType with a non-repeating top-level group and no attributes is represented directly as a document type without a distinct attribute or content child, and its content is represented as a group-value.
Indirect-items are specialized items that represent tags and values expressed in an indirect way. There are two kinds of indirect items: substitution-items, and any-items. The indirect representation of these values makes the Java API a bit more complex than might be wanted, but it allows a more straight-forward visual representation in Document Types and Flow Maps.
If the tag is not repeating, then the object is a single item. If the tag is repeating (schema maxOccurs > 1) then the object is an array of items. When conforming document types are used, the array type matches the value type: repeating simple-values are represented as String[], repeating group-values, complex-values and indirect-items are represented as IData[], and repeating anyTypes are represented as Object[]. When conforming document types are not used, all repeating values are represented as Object[]s.
In a more obvious departure from the legacy format, the tag has a very specialized format.
The tag is comprised of several components: a particle-id, a local name, and an optional namespace.
The particle-id allows repeated occurrence of a name in a model to be uniquely identified.
The repeated occurrence is not relative to the maxOccurs attribute, rather it identifies the repeated use of the same tag at different locations in a model.
The XmlData feature encodes QNames as {particleId}ncName#namespaceURI rather than prefix:ncName.
This eliminates the need for and complexity of a disjointed definition of the namespace elsewhere such as in a document type or in an instance nsDecls
map.
The particle-id ensures that Flow Map references to a particular tag remain unambiguous, even if the tags are created out of order.
There are four types of content-tags: element-tags, group-tags, any-tags, and substitution-tags. (The legacy form of IData encoding for XML only has element tags.)
When XmlData is used without a conforming document type, only element-tags are present (though a top-level group-tag may be present in a complex-value).
Collectively, the four tag types mentioned above are called content-tags because they appear in content models. There is a one-to-one correspondence between content-tags and particles in a schema content model. Each schema 'element' particle has a corresponding element-tag. Each schema 'any' particle has a corresponding any-tag. Each schema substitution group head has a corresponding substitution-tag, and each schema 'group' has a corresponding group-tag.
Some content items have specialized structure. any-tags have associated any-items with a specialized structure that contains the NCName, Namespaces, and a value member that references the actual value. This indirect representation allows Flow Maps to manipulate both the wildcard name and its value. substitution-tags also have associated substitution-item with a specialized structure. This indirect representation allows Flow Maps to present all of the possible members of a substitution group. The item contain an IData that contains the actual instance tag-object-pair.Using a simple example, the XML content:
lt;inv:address xmlns:inv="www.invoice.com">555 Mockingbird Lane</inv:address>is represented in the legacy format using IData as key/value pair:
IData containing: "inv:address" :: "555 Mockingbird Lane"with the prefix "inv" being defined externally. While in the new XmlData format, it is represented as an IData key/value pair:
IData containing: "address#www.invoice.com" :: "555 Mockingbird Lane"
When creating document types from schemas, model groups (sequence, choice, and all) are represented using a field named *group
(i.e. a group-tag)
with a field type of Document. The document type contains the child content definition of the group.
When complex-values have attributes, the attributes are encoded under a separate Document containing the attributes. This separate IData value
has a key named *attributes
. If simple content is present with attributes, it is encoded using the key *simple
.
If a schema contains an any wildcard, that particle is represented as a field with an any-tag {particleId}*any
and a content of Document.
The Document content is a very specialized any-object format described later.
If a schema contains substitution groups, the head of a substitution group is encoded as field with substitution-tag *substitution-
name with a very
specialized IData content that is described later.
Finally, the members of model groups are further qualified by a leading particle-id of the form {1}, {2}, ... etc. This prefix uniquely identifies particles in
a group since more than one particle with the same name can appear throughout a content model. Such qualification applies to group-tags,
any-tags, substitution-tags, and
element-tags, and is present even when the names are not repeated.
This qualification is in addition to element repetition. For example, an element named "student" might have a maxOccurs property of 5 in one part of a content model
and a maxOccurs property of 1 at some later point in the model. Thus, the first occurrence {1}student
is defined as an array while the second
occurrence {2}student
is a scalar. In similar fashion, a content model might contain two choice groups. The first choice group is defined by a field with
name {1}*group
while the second choice group is defined by a field named {2}*group
.
These examples illustrate the encoding. For clarity, unqualified names as used. Though, the same layout is used for qualified names.
In the following examples, the notation x :: y simply means tag x is paired with value y in the IData encoding.
Simple String content such as:
<name>kilroy</name>is encoded as a single IData key/value pair with the value being a simple String:
IData containing: "{1}name" :: "kilroy"Note that the
name
field has been prefixed with {1}
to denote the first occurrence of the element in the content.
More complex content such as
<people xmlns:family> <brother>Sam</brother> <sister>Karen</sister> <brother>Bill</brother> </people>is encoded in a similar way with multiple tag-object-pairs:
IData containing: "{1}people#family" :: IData containing: "{1}brother#family" :: "Sam" "{1}sister#family" :: "Karen" "{2}brother#family" :: "Bill"Note that field names such as
{1}brother#family
include the XML namespace. Also note there there are distinct occurrences of the
brother#family
element each with a unique prefix. However, if content contains adjacent repeating elements,
the content is represented as an array.
<people xmlns:family> <brother>Sam</brother> <brother>Bill</brother> <sister>Karen</sister> </people>is encoded in a somewhat similar way, but uses a String[] for the repeated value:
IData containing: "{1}people#family" :: IData containing: "{1}brother#family" :: String[] containing: [0] "Sam" [1] "Bill" "{1}sister#famiily" :: "Karen"Content with attributes such as:
<item size="medium" color="blue"> <supplier>ABC Inc.</supplier> <distributor> XYZ Inc.</distributor> </item>is encoded as two separate sub-documents named *attributes and *group
IData containing: "{1}item" :: IData containing: "*attributes" :: IData containing: "size" :: "medium" "color" :: "blue" "{1}*group" :: IData containing: "{1}supplier" :: "ABC Inc." "{1}distributor" :: "XYZ Inc."When an element has attributes but only simple content, such as
<item size="medium" color="blue">shoe</item>the simple content is encoded as a *simple key/value pair rather than a *group sub-document
IData containing: "{1}item :: IData containing: "*attributes" :: IData "size" :: "medium" "*simple" :: "shoe"
In the preceding examples, the group-tag and group-value was present only when attributes were also present. Otherwise, the group-tags are not typically needed when only child elements are present. However, if an element has maxOccurs > 1 and its top-level model group also has maxOccurs > 1, it is necessary that the group-tag be present because both the element and the group-values have repeating values stored as arrays. For example, given this XML document:
<employees> <name>Sam</name> <address>Mars</address> <name>Mary</name> <address>Venus</address> </employees> <employees> <name>George</name> <address>Pluto</address> <name>Sally</name> <address>Saturn</address> </employees>If employees is defined as a particle with maxOccurs > 1 and its content model is defined as multiple repetitions of name and address, then the IData representation of the XML is:
IData containing: "{1}employees" :: IData[] containing: [0] IData containing: "{1}*group" :: IData[] containing: [0] IData containing: "{1}name" :: "Sam" "{1}address" :: "Mars" [1] IData containing: "{1}name" :: "Mary" "{1}address" :: "Venus" [1] IData containing:` "*{1}group" :: IData[] containing: [0] IData containing: "{1}name" :: "George" "{1}address" :: "Pluto" [1] IData containing: "{1}name" :: "Sally" "{1}address" :: "Saturn"
There are two schema features that make it impossible to know the tag names of values when document types are created from schemas. The first is the any wildcard. The other is the substitution group.
The any wildcard is a placeholder for element names that are not determined until an instance document is parsed. In order to facilitate access and manipulation from Flow, the any wildcard is represented as a Document with fields named *ncName, *namespace, and *value. This makes it possible for Flow programs to access or change both the name and the value of an XmlData tag-object-pairs that correspond to any wildcards.
An XML instance document containing a element such as:
<occupation>driver</occupation>that corresponded to an any particle in the source schema, would have an XmlData value represented as:
IData containig: "*ncNam" :: "occupation" "*namespaece" :: null "*value " :: "driver"Note that XmlData content never contains the Java null. But the *namespace field describes the tag rather than the content, and does use the Java null to signify the tag is not namespace qualified.
The substitution group allows a element to replace another element. It is, in a sense, the element equivalent to type derivation. In order to facilitate access and manipulation from Flow, a substitution group is represented as a head-of-group-element, with children that correspond to the elements that can replace the head. For example, an element named "vehicle" might be the head of a group that includes "car", "truck", and "bus". The document type that represents the group is:
{1}substitution-vehicle [Document Type, choice model] {1}car [Field] {1}truck [Field] {1}bus [Field]The document type has a choice model group because only one of the substitution members can be present. This structure implies that the head of a group is modeled as group with IData content even when the head is simple type in the corresponding schema.
An instance that conforms to the substitution group is:
IData containing: "{1}substitution-vehicle" :: IData containing: "{1}truck" :: "Peterbilt"
schema construct | XmlData construct |
---|---|
simpleType | simple-value |
complexType with simpleContent and attributes | complex-value with a *attributes field paired with an attribute-set and a *simple field paired with a simple-value |
complexType with complexContent but with no attributes or repeating top-level model group
(i.e. maxOccurs=1 sequence, choice, or all) |
group-value |
nested model group (sequence or choice) | group-value or array of group-values if maxOccurs > 1 |
complexType with complexContent and attributes
(sequence, choice, all) |
complex-value with a *attributes field paired with an attribute-set and a {1}*group field paired with a scalar group-value if maxOccurs = 1 or an array of group-values if maxOccurs > 1 |
complexType with complexContent, no attributes, and repeating top-level model group
(sequence or choice) |
complex-value with a {1}*group field paired with an array of group-values |
complexType mixed=true | complex-value but mixed content is discarded |
createAnyItem(XmlDataElementTag, Object)
method.
XmlDataCursor.getTag()
method returns the any-tag;
the XmlDataCursor.getValueTag(int...)
method returns the actual tag in the XML infoset that corresponds to the any particle.
Any-tags can be created and parsed using the XmlDataAnyTag
class.
XmlDataCursor
or XmlData
helper methods are used. Attribute-sets are only ever referenced from a complex-value.
Attribute-sets may be created using the createAttributes(Object...)
method.
XmlDataAnyTag
class.
createComplexValue()
method.XmlDataPath
class.XmlDataElementTag
class.
XmlDataTag.getFullName()
method on an instance of a parsed-tag such as an
instance of XmlDataElementTag
, XmlDataAttributeTag
, XmlDataGroupTag
, XmlDataAnyTag
,
XmlDataSubstitutionTag
, or XmlDataTypeTag
XmlDataGroupTag
class.
createGroupValue(Object...)
method. They may also be manipulated by obtaining an
XmlDataCursor
for a group-value using the getXmlDataCursor(IData)
method and then using the various cursor methods
to navigate the group-value, adding, deleting, or modifying members of the group-value.XmlDataIteratorTag
class.
XmlDataMap
copy-paths when it is necessary to specify the value-tag for an indirect-item.XmlDataIteratorTag
class.
XmlDataTag
)
is used to construct and manipulate tags as a collection of component parts. These subclasses are XmlDataElementTag
, XmlDataAttributeTag
, XmlDataGroupTag
,
XmlDataAnyTag
, and XmlDataSubstitutionTag
. These classes have constructors that accept the various component parts of a tag: ncName, namespace, and particle-id.
They also have methods such as getFullName() and getPathName() that construct the complete form of the tag as a String. Many XmlData classes expect tags in parsed form
(a subclass of XmlDataTag) rather than String form.
/step1/step2 ...where each step is a tag in path-name format. Many methods also accept a path specified as an array of parsed-tags.
ncName#namespaceURI[index]{indirect-qualifier}
XmlDataCursor.getTag()
method returns the substitution-tag;
the XmlDataCursor.getValueTag(int...)
method returns the actual tag present in the source XML infoset that corresponds to the substituted element tag.
A substitution-tag can be created and parsed using the XmlDataSubstitutionTag
class.
ncName#namespaceURIIf the tag does not have a namespace qualifier, the # separator is also excluded. Tags never appear alone. They are always part of a tag-object-pair in a group-value or as part of a tag-object-pair in an attribute-set. When a tag is used in a group-value, it also has a particle-id prefix that identifies the relative position of like-named particle in the corresponding schema model group. Tags that have a particle-id prefix are called content-tags. The full-name format of a content-tag includes the particle-d and is:
{particle-id}ncName#namespaceWhen a tag is used in an attribute-set it does not have particle-id prefix. An XmlData infoset contains many types of tags: element-tags, attributes-tags, group-tags, substitution-tags, and any-tags. Element-tags and attribute-tags correspond directly to the element tags and attribute tags in the source XML infoset. group-tags, any-tags, and substitution-tags do not correspond with tags present in the source XML infoset. Instead they correspond to XML schema structures that are created in the XmlData infoset and contain the additional information that describes model group, any wildcards, and substitution groups. element-tags, group-tags, any-tags, and substitution-tags are all content-tags because they correspond to group models or particle in a schema content model, and therefore can appear more than once in a model and require the particle-id for unique identification. In addition to the full-name format that appears in XmlData infosets, there is also the path-name format. The path-name format includes additional properties and is in the form:
{particle-id}ncName#namespaceURI[index]{indirect-qualifier}The path-name format is used in map-paths and copy-paths. They provide additional information when accessing repeating values or creating indirect-items.
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
copy(java.lang.Object in)
Makes a copy of any valid XmlData value.
|
static IData |
createAnyItem(XmlDataContentTag tag,
java.lang.Object item)
Creates an any-item depending on the type of the content-tag.
|
static IData |
createAnyItem(XmlDataElementTag tag,
java.lang.Object value)
Creates an any-item IData with *ncName and *namespace fields paired with values
derived from the specified tag.
|
static IData |
createAnyItem(XmlDataSubstitutionTag tag,
IData substitutionItem)
Creates an any-item document with a substitution-item nested within it.
|
static IData |
createAnyItem(XmlDataSubstitutionTag subsTag,
XmlDataElementTag eTag,
java.lang.Object value)
Creates an any-item document with a nested substitution-item.
|
static IData |
createAttributes(java.lang.Object... pairs)
|
static IData |
createComplexValue()
Creates a new empty complex-value.
|
static IData |
createComplexValue(IData attributes,
java.lang.Object itemContent)
Creates a new populated complex-value.
|
IData[] |
createEmptyGroupList(int size)
Creates a list of empty IDatas.
|
java.lang.String[] |
createEmptyStringList(int size)
Creates a list of empty Strings.
|
static IData |
createGroupValue(java.lang.Object... pairs)
Creates a new group-value.
|
java.lang.Object[] |
createObjectList(java.lang.Object[] list)
Converts an array to an explicit Object[].
|
static IData |
createSubstitutionItem(XmlDataElementTag tag,
java.lang.Object content)
Creates an IData object in the form of substitution-item.
|
static boolean |
equalTo(java.lang.Object objA,
java.lang.Object objB)
Tests equality of two XmlData formatted objects.
|
static java.lang.Object |
getAnyItemObject(IData anyItem)
Returns the object paired with the *value field of an any-item.
|
static XmlDataContentTag |
getAnyItemTag(IData anyContent)
Returns the XmlDataElementTag from an any-item.
|
static java.lang.Object |
getAnyItemValue(IData anyItem)
Returns the value of an any-item.
|
static XmlDataElementTag |
getAnyItemValueTag(IData anyItem)
Returns an
XmlDataElementTag created from an any-item. |
IData |
getAttributes(java.lang.Object value)
Returns the content of the *attributes field in a complex-value.
|
static java.lang.Object |
getComplexValueContent(IData complexValue)
Finds the content of a complex-value.
|
static java.lang.Object |
getContent(java.lang.Object value)
Returns the content portion of a value.
|
static java.lang.String |
getInstanceProp(IData data,
XmlDataElementTag tag,
java.lang.String prop,
int... index)
Retrieves an xsi property on an element.
|
static IData |
getNamespacePrefixes(IData data,
XmlDataElementTag tag,
int... index)
Gets all prefix/URI pairs for a an element.
|
static java.lang.String |
getNamespacePrefixValue(IData data,
XmlDataElementTag tag,
java.lang.String prefix,
int... index)
Gets the namespace URI for the specified prefix.
|
static java.lang.Object |
getObject(IData groupValue,
XmlDataContentTag tag)
Convenience method that returns the Object value of a tag without explicitly obtaining and destroying a cursor.
|
static java.lang.Object |
getSubstitutionItemValue(IData substitutionContent)
Returns the value of the substituted element in a substitution-item
|
static XmlDataElementTag |
getSubstitutionItemValueTag(IData substitutionItem)
Returns the XmlDataElementTag of the substitution-item.
|
static XmlDataCursor |
getValueCursor(java.lang.Object value)
Returns an XmlDataCursor for an input value that is a group-value.
|
static XmlDataTreeCursor |
getValueTreeCursor(java.lang.Object value)
Returns an XmlDataTreeCursor for an input value that is a group-value.
|
static XmlDataCursor |
getXmlDataCursor(IData group)
Creates and returns an XmlDataCursor on the specified group-value.
|
static XmlDataTreeCursor |
getXmlDataTreeCursor(IData group)
Creates and return an XmlDataTreeCursor on the specified group-value.
|
static void |
internNames(boolean b)
Determines when XmlDataTags are interned Strings.
|
static boolean |
isAny(XmlDataContentTag tag)
Returns true of the specified tag is a *any wildcard tag.
|
static boolean |
isComplexValue(java.lang.Object value)
Determines if a value is a complex-value.
|
static boolean |
isEmpty(java.lang.Object content)
Returns true if content is empty.
|
static boolean |
isGroupValue(java.lang.Object group)
Determines if a value is a group-value.
|
static boolean |
isIntern()
Indicates whether XmlDataTags are interned Strings.
|
static boolean |
isSimpleValue(java.lang.Object object)
Returns true if the object argument is an instance of String.
|
static boolean |
isSubstitution(XmlDataContentTag tag)
Returns true if the specified tag is a substitution tag.
|
static java.lang.Object |
makeRepeating(java.lang.Object val)
Converts a scalar item into a repeating value with a single value.
|
static void |
setAnyItemObject(IData anyItem,
java.lang.Object indirectItem)
Sets the *value property of a any-item.
|
static void |
setAnyItemTag(IData anyItem,
XmlDataContentTag key)
Sets the ncName and namespace properties of an any-item.
|
static void |
setAnyItemValue(IData anyItem,
java.lang.Object indirectItem)
Sets the *value property in an any-item.
|
static void |
setAnyItemValueTag(IData anyItem,
XmlDataElementTag name)
Sets the ncName and namespace for properties of an any-item.
|
static void |
setAttributes(IData value,
IData attributes)
For a complex values, sets the attributes, for example, attribute created using
createAttributes(Object...) |
static void |
setComplexValueContent(IData value,
java.lang.Object content)
Sets the content portion of a complex value.
|
static void |
setInstanceProp(IData data,
XmlDataElementTag tag,
int index,
java.lang.String xsiTag,
java.lang.String xsiValue)
Sets the xsi prop declaration for a given XmlData element with repeating values.
|
static void |
setInstanceProp(IData data,
XmlDataElementTag tag,
java.lang.String xsiTag,
java.lang.String xsiValue)
Sets the xsi prop declaration for a given XmlData element with a non-repeating value.
|
static void |
setNamespacePrefix(IData data,
XmlDataContentTag tag,
int index,
java.lang.String prefix,
java.lang.String namespace)
Sets the prefix/namespace declaration for a given XmlData element with a repeating values.
|
static void |
setNamespacePrefix(IData data,
XmlDataContentTag tag,
java.lang.String prefix,
java.lang.String namespace)
Sets the prefix/namespace declaration for a given XmlData element with a non-repeating value.
|
static void |
setOrAppendObject(IData groupValue,
XmlDataContentTag tag,
java.lang.Object value)
A convenience method to set the object at the specified tag without explicitly obtaining and destroying a cursor.
|
static void |
setSubstitutionItemValue(IData substitutionItem,
java.lang.Object content)
Sets the value of the substituted element in a substitution-item
|
static void |
setSubstitutionItemValueTag(IData substitutionItem,
XmlDataElementTag tag)
Sets the XmlDataElementTag for the substituted element in a substitution-item
|
static java.lang.String |
valueType(java.lang.Object value)
Returns the type name of a non-repeating value.
|
public static java.lang.Object copy(java.lang.Object in)
in
- make a copy of the input Objectpublic static IData createAnyItem(XmlDataElementTag tag, java.lang.Object value)
tag
- the element-tag used to construct the *ncName and *namespace fieldsvalue
- the any-item value (the *value field)createAnyItem(XmlDataSubstitutionTag, IData)
,
createAnyItem(XmlDataSubstitutionTag, XmlDataElementTag, Object)
,
createAnyItem(XmlDataContentTag, Object)
public static IData createAnyItem(XmlDataSubstitutionTag tag, IData substitutionItem)
createSubstitutionItem(XmlDataElementTag, Object)
tag
- the name of the substitution group headsubstitutionItem
- the substitution-item used as value. It must be a well-formed substitution-item.XmlDataException.ArgumentError
- when the content is not a valid substitution-item.public static IData createAnyItem(XmlDataContentTag tag, java.lang.Object item)
tag
- the content-tag which must either be a substitution-tag or an element-tagitem
- the item; it must be a substitution-item if tag is a substitution-tag; for an element it may be a complex-value, group-value,
or simple-valuepublic static IData createAnyItem(XmlDataSubstitutionTag subsTag, XmlDataElementTag eTag, java.lang.Object value)
subsTag
- the XmlDataSubstitutionTag for the contenteTag
- the XmlDataElement tag for the substitution-item.value
- the value for the substitution-item.public static IData createAttributes(java.lang.Object... pairs)
createComplexValue(IData, Object)
method.
The result is an IData with members that are attribute-tags paired with String values.pairs
- pairs of alternating XmlDataAttributeTags and Strings attribute value.XmlDataException.FormatError
- when an odd number of arguments is passedXmlDataException.UnsupportedType
- when an attribute value is not a StringXmlDataException.TagAndContentConflict
- when a pair starts with anything except an XmlDataAttributeTagpublic static IData createComplexValue()
XmlDataCursor.setContent(Object, int...)
and XmlDataCursor.setAttributes(IData, int...)
methods.
Complex-values should be used only as element values, never as attribute values.
At present, this method creates an empty IData. However, it is preferable to use this method to create the empty IData rather than using
an IData factory because future XmlData implementations may impose additional constraints on complex-values.public static IData createComplexValue(IData attributes, java.lang.Object itemContent)
XmlDataCursor.setContent(Object, int...)
and XmlDataCursor.setAttributes(IData, int...)
methods.
complex-values should be used only as element values, never as attribute values.
If the content is a non-repeating group-value and no attributes argument is provided, an empty IData is used as the attributes argument.
The complex-value is populated with the specified attributes value (if not null) and is populated with
group content if content is an IData, or simple content using a *simple tag if content is a String.attributes
- the attribute values, typically constructed by a call to XmlData.createAttributesitemContent
- the complex-value's complex-value-content (either a String for simple content, or group content.XmlDataException.UnsupportedType
- when value is not an IData or Stringpublic IData[] createEmptyGroupList(int size)
size
- the number of entriespublic java.lang.String[] createEmptyStringList(int size)
size
- the number of entriespublic static IData createGroupValue(java.lang.Object... pairs)
pairs
- possibly empty Object[] where even members are instances of XmlDataContentTag subclasses and odd members are content
objects suitable for their corresponding tag that immediately precedes them.XmlDataException.ArgumentError
- when an odd number of arguments is passedXmlDataException.TagAndContentConflict
- when the first member of a pair is not an XmlDataContentTagXmlDataException.UnsupportedType
- when the second member of a pair is not valid XmlData content: String, String[], IData, IData[], or Object[]public java.lang.Object[] createObjectList(java.lang.Object[] list)
list
- the input array (typically String[] or IData[]XmlDataException.UnsupportedType
- when a member of the list is not a String or IDatapublic static IData createSubstitutionItem(XmlDataElementTag tag, java.lang.Object content)
tag
- the XmlDataElementTag of the substituted elementcontent
- the contentXmlDataException.UnsupportedType
- when content is not a String or IData instancepublic static boolean equalTo(java.lang.Object objA, java.lang.Object objB)
objA
- the first ObjectobjB
- the second Objectpublic static XmlDataContentTag getAnyItemTag(IData anyContent)
getAnyItemValueTag(IData)
is used to obtain
the tag associated with the indirect content.anyContent
- the IData object in the *any formatpublic static java.lang.Object getAnyItemObject(IData anyItem)
getAnyItemValue(IData)
. However,
when the *value field contains a substitution-item, getAnyItemValue() retrieves the value of the substitution-item,
while getAnyItemObject() returns the entire substitution-item.anyItem
- the IData object in the any-item formatpublic static java.lang.Object getAnyItemValue(IData anyItem)
anyItem
- an any-itempublic static XmlDataElementTag getAnyItemValueTag(IData anyItem)
XmlDataElementTag
created from an any-item. Typically, it is created from the *ncName and *namespace fields of the any-item
object. However, If *ncName field is paired with a substitution-tag, then the tag of the first child of the
substitution-item is returned.anyItem
- the any-itempublic IData getAttributes(java.lang.Object value)
value
- the value that is examined.public static java.lang.Object getComplexValueContent(IData complexValue)
isComplexValue(Object)
returns true
because there is no {1}*group or *simple tag with associated content.
By convention, empty IData normally represent empty groups rather than empty complex values.
This method is similar to the XmlDataCursor.getComplexValueContent(int...)
method, but it operates on a free-standing value, rather than a
value that is specified by a cursor.complexValue
- the value from which the *simple or top-level *group value is returnedXmlDataException.FormatError
- when the parent is not a complex-value.public static java.lang.Object getContent(java.lang.Object value)
getComplexValueContent(IData)
} is returned. If the complex value has no content, null is returned; but if the complex value
can be interpreted as an empty group, the empty group is returned (an empty IDta rather than null), If the content is a repeating group, an IData[] is returned.value
- the input valuepublic static java.lang.String getInstanceProp(IData data, XmlDataElementTag tag, java.lang.String prop, int... index)
data
- the parent IDatatag
- the XMlDataElementTag to be queriedprop
- the property queried, for example: type, nilindex
- the optional offset into repeating valuespublic static java.lang.String getNamespacePrefixValue(IData data, XmlDataElementTag tag, java.lang.String prefix, int... index)
data
- the parent IDatatag
- the XmlDataElementTag to be queriedprefix
- the prefix queriedindex
- the optional offset index if repeating values are presentpublic static IData getNamespacePrefixes(IData data, XmlDataElementTag tag, int... index)
data
- the parent IData objecttag
- the XmlDataElementTag for which the pairs are retrievedindex
- option offset in array if repeating values are presentpublic static java.lang.Object getObject(IData groupValue, XmlDataContentTag tag)
groupValue
- the group-value than contains the tag.tag
- the tag associated with the Objectpublic static java.lang.Object getSubstitutionItemValue(IData substitutionContent)
substitutionContent
- the *substitution formatted contentXmlDataException.FormatError
- when the substitutionContent is nullpublic static XmlDataElementTag getSubstitutionItemValueTag(IData substitutionItem)
substitutionItem
- is the substitution-itempublic static XmlDataCursor getValueCursor(java.lang.Object value)
value
- the value for which an XmlDataCursor is returned, if possible, and positioned on the first content tag if it exists.public static XmlDataTreeCursor getValueTreeCursor(java.lang.Object value)
value
- the value for which an XmlDataTreeCursor is returned, if possible, and positioned on the first content tag if it exists.public static XmlDataCursor getXmlDataCursor(IData group)
group
- the IData object for which an XmlDatCursor is created. This should only be an IData intended for use as group-value.public static XmlDataTreeCursor getXmlDataTreeCursor(IData group)
group
- a cursor positioned on the item for which a tree cursor is createdpublic static void internNames(boolean b)
b
- if true, names are interned Strings; otherwise names are discrete strings.public static boolean isAny(XmlDataContentTag tag)
tag
- the tag that is testedpublic static boolean isComplexValue(java.lang.Object value)
isGroupValue(Object)
method also returns true if the value is a completely empty IData.
This means that an empty IData will return true for both isComplexValue() and isGroupValue().value
- the value to be testedpublic static boolean isEmpty(java.lang.Object content)
getContent(Object)
Empty is defined as follows:
content
- the content to testpublic static boolean isGroupValue(java.lang.Object group)
isComplexValue(Object)
method also returns true if the value is a completely empty IData.
This means that an empty IData will return true for both isComplexValue() and isGroupValue().group
- the value to be testedpublic static boolean isIntern()
public static boolean isSimpleValue(java.lang.Object object)
object
- the object to testpublic static boolean isSubstitution(XmlDataContentTag tag)
tag
- the tag that is testedpublic static java.lang.Object makeRepeating(java.lang.Object val)
val
- the value to be converted. Must be of type String or IDatapublic static void setAnyItemTag(IData anyItem, XmlDataContentTag key)
anyItem
- the any-item. The setAnyValueKey method is preferable to this method. This method is ued only
when directly modifying the any-item fields regardless of content (such as a substitution group).key
- the XmlDataContentTag that provides the ncName and the XML namespace URIXmlDataException.FormatError
- if the any document has an invalid structurepublic static void setAnyItemObject(IData anyItem, java.lang.Object indirectItem)
anyItem
- An any-item.indirectItem
- the item assigned to the *value property.XmlDataException.FormatError
- if indirectItem is null, or the IData cannot be formatted properly.public static void setAnyItemValue(IData anyItem, java.lang.Object indirectItem)
anyItem
- the IData object that is formatted as an any-itemindirectItem
- the value to set in the any-tem *value propertypublic static void setAnyItemValueTag(IData anyItem, XmlDataElementTag name)
setAnyItemTag(IData, XmlDataContentTag)
except
when the content is a substitution-item. In that situation, the key of the value in the substitution-item is changed.
When working with content, this method is typically preferable to setAnyItemKey because it sets the key for the logical content
regardless of whether it's a element or a substitution group.anyItem
- the value of the element wildcardname
- the XmlDataElementTag naming the wildcard elementXmlDataException.FormatError
- if anyItem is not an IDatapublic static void setAttributes(IData value, IData attributes)
createAttributes(Object...)
value
- the value for which attributes are setattributes
- the attributespublic static void setComplexValueContent(IData value, java.lang.Object content)
value
- the IData complex-value into which the content is insertedcontent
- the content (For example, as returned by getComplexValueContent(IData)
XmlDataException.FormatError
- if the value is not in complex value formatpublic static void setInstanceProp(IData data, XmlDataElementTag tag, java.lang.String xsiTag, java.lang.String xsiValue)
data
- the IData parent of the tag for which the xsi property is being settag
- the element-tag for which the property is being setxsiTag
- the xsi tag being setxsiValue
- the xsi tag valuepublic static void setInstanceProp(IData data, XmlDataElementTag tag, int index, java.lang.String xsiTag, java.lang.String xsiValue)
data
- the IData parent of the tag for which the xsi property is being settag
- the element-tag for which the property is being setindex
- the offset into the array of repeating valuesxsiTag
- the xsi tag being setxsiValue
- the xsi tag valuepublic static void setNamespacePrefix(IData data, XmlDataContentTag tag, java.lang.String prefix, java.lang.String namespace)
data
- is the IData parent of the tag for which the namespace prefix is settag
- is the element-tag for which the namespace prefix is setprefix
- is the prefix which is being definednamespace
- is the namespace assigned to the prefixpublic static void setNamespacePrefix(IData data, XmlDataContentTag tag, int index, java.lang.String prefix, java.lang.String namespace)
data
- is the IData parent of the tag for which the namespace prefix is settag
- is the element-tag for which the namespace prefix is setindex
- is the offset into the array of repeating valuesprefix
- is the prefix which is being definednamespace
- is the namespace assigned to the prefixpublic static void setOrAppendObject(IData groupValue, XmlDataContentTag tag, java.lang.Object value)
groupValue
- the group containing the tagtag
- the specified tagvalue
- the Object to be setpublic static void setSubstitutionItemValue(IData substitutionItem, java.lang.Object content)
substitutionItem
- the IData substitution-itemcontent
- the value to be stored in the child of the substitution groupXmlDataException.FormatError
- when value is null or substitutionContent does not have a childpublic static void setSubstitutionItemValueTag(IData substitutionItem, XmlDataElementTag tag)
substitutionItem
- the *substitution formatted IData objecttag
- the XmlDataElement tag of the substituted elementXmlDataException.FormatError
- when substitution content is null or has no childpublic static java.lang.String valueType(java.lang.Object value)
value
- the input: simple-value, group-value, complex-value;
typically an Object returned by getValue()