public class XmlDataPath
extends java.lang.Object
XmlDataContentTags that are used for navigation exploit tag features that are not exploited by Xml document types or by the XmlData helper class. These features are index specification (for repeating content) and content naming (for substitution groups and any wildcards). These features are only relevant when navigating an XmlData tree (for example using an XmlDataMap).
When a path is encoded as a String it is represented as a sequence of path steps, generally of the form /{id}prefix:ncname[index]. The [index} is specified only when accessing repeating content. The prefix: is specified only when elements are namespace-qualified. When a step requires content naming, and additional qualifier is appended, for example, /{2}*substitution-able{{1}baker} specifies a content tag for a substitution group that has a child element named 'baker'. In order to encode or decode a path literal, an XMlNamespaceMap must also be provided. The map may be specified in literal form, or an XmlNamespaceMap instance.
Typical paths: /{1}able /{2}charlie[3]/{1}epsilon /{2}*group/{1}*any{{1}nsx:abc}XmlDataCopy supports an additional other type of content-tag, the iterator-tag. The iterator-tag serves as a wild-card during copy. Iterator-tags must begin with the ! character and may be used as wildcard placeholders for full-names, indexes, or indirect-qualifiers. The name is purely symbolic and arbitrary; the only relevance of the symbolic name is that iterator-tag names on the input side are correspondingly matched with same-named tags on the output side by XmlDataCopy.
Typical iterator-tag usage: /{1}name[!instance]/!item !instance iterates of the index of the repeating value at {1}name while !item iterates over the full-names of each item in {1}name /{1}*any{!item}Name !item is assigned the value-tag associated with {1}*any
Constructor and Description |
---|
XmlDataPath() |
Modifier and Type | Method and Description |
---|---|
static XmlDataContentTag[] |
createFromString(java.lang.String path)
Creates a path from a single String literal.
|
static XmlDataContentTag[] |
createFromString(java.lang.String path,
java.lang.String prefixes)
Creates a Path (an array of XmlDataContentTags) from a path String literal and a namespace declaration String literal.
|
static XmlDataContentTag[] |
createFromString(java.lang.String path,
XmlNamespaceMap map)
Creates an XmlDta path (an array of XmlDataContentTags) from a path String literal and an XmlNamespaceMap instance.
|
static boolean |
equals(XmlDataContentTag[] path1,
XmlDataContentTag[] path2)
Tests the equality of two paths.
|
static java.lang.String |
getAsString(XmlDataContentTag[] tags,
XmlNamespaceMap map)
Creates a path literal string using the specified path (array of XmlDataContentTags_ and XmlNamespaceMap.
|
static java.lang.String |
getAsStringWithMap(XmlDataContentTag[] tags)
Creates a path literal string and prepends a prefix map declaration.
|
static java.lang.String |
getAsStringWithMap(XmlDataContentTag[] tags,
XmlNamespaceMap map)
Creates a path literal string and prepends a prefix map declaration.
|
static XmlDataContentTag[] |
removeLeaf(XmlDataContentTag[] tags) |
public static XmlDataContentTag[] createFromString(java.lang.String path, java.lang.String prefixes)
path
- path in literal form: e.g., {1}x:abc (where x is a declared prefix)prefixes
- prefix declarations specified as space-separated list of prefixes and associated namespacespublic static XmlDataContentTag[] createFromString(java.lang.String path, XmlNamespaceMap map)
path
- string literal specifying the pathmap
- a map specifying namespace prefix/URI associationspublic static XmlDataContentTag[] createFromString(java.lang.String path)
path
- a String literal representation of path that does not require namespace qualification, or has an explicit map encoded in the literalpublic static java.lang.String getAsString(XmlDataContentTag[] tags, XmlNamespaceMap map)
tags
- a list of input tagsmap
- the namespace mappublic static java.lang.String getAsStringWithMap(XmlDataContentTag[] tags)
tags
- input tagspublic static java.lang.String getAsStringWithMap(XmlDataContentTag[] tags, XmlNamespaceMap map)
tags
- input tags that define a pathmap
- the input XmlNamespaceMappublic static boolean equals(XmlDataContentTag[] path1, XmlDataContentTag[] path2)
path1
- A path defined by an XmlDataContentTag[].path2
- A path defined by an XmlDataCOntentTag[].public static XmlDataContentTag[] removeLeaf(XmlDataContentTag[] tags)