Interface XmlNode
- All Known Implementing Classes:
XmlNodeImpl
An immutable XML node representation that provides a clean API for working with XML data structures.
This interface represents a single node in an XML document tree, containing information about
the node's name, value, attributes, and child nodes.
Example usage:
XmlNode node = XmlNode.newBuilder()
.name("configuration")
.attribute("version", "1.0")
.child(XmlNode.newInstance("property", "value"))
.build();
- Since:
- 4.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classBuilder class for creating XmlNode instances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of a specific attribute.Returns an immutable map of all attributes defined on this XML node.Returns the first child node with the specified name.children()Returns an immutable list of all child nodes.default StringgetAttribute(String name) Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.default XmlNodeDeprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.default ObjectDeprecated, for removal: This API element is subject to removal in a future version.default StringgetName()Deprecated, for removal: This API element is subject to removal in a future version.default StringDeprecated, for removal: This API element is subject to removal in a future version.default StringDeprecated, for removal: This API element is subject to removal in a future version.default StringgetValue()Deprecated, for removal: This API element is subject to removal in a future version.Returns the input location information for this node, if available.default XmlNodeDeprecated, for removal: This API element is subject to removal in a future version.default XmlNodeDeprecated, for removal: This API element is subject to removal in a future version.useXmlService.merge(XmlNode, XmlNode, Boolean)insteadstatic XmlNodeDeprecated, for removal: This API element is subject to removal in a future version.useXmlService.merge(XmlNode, XmlNode, Boolean)insteadstatic XmlNodename()Returns the local name of this XML node.Returns the namespace URI of this XML node.static XmlNode.BuilderReturns a new builder for creating XmlNode instances.static XmlNodenewInstance(String name) Creates a new XmlNode instance with the specified name.static XmlNodenewInstance(String name, String value) Creates a new XmlNode instance with the specified name and value.static XmlNodenewInstance(String name, String value, Map<String, String> attrs, List<XmlNode> children, Object location) Creates a new XmlNode instance with all properties specified.static XmlNodenewInstance(String name, List<XmlNode> children) Creates a new XmlNode instance with the specified name and children.prefix()Returns the namespace prefix of this XML node.value()Returns the text content of this XML node.
-
Field Details
-
CHILDREN_COMBINATION_MODE_ATTRIBUTE
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
CHILDREN_COMBINATION_MERGE
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
CHILDREN_COMBINATION_APPEND
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
DEFAULT_CHILDREN_COMBINATION_MODE
Deprecated, for removal: This API element is subject to removal in a future version.This default mode for combining children DOMs during merge means that where element names match, the process will try to merge the element data, rather than putting the dominant and recessive elements (which share the same element name) as siblings in the resulting DOM.- See Also:
-
SELF_COMBINATION_MODE_ATTRIBUTE
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
SELF_COMBINATION_OVERRIDE
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
SELF_COMBINATION_MERGE
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
SELF_COMBINATION_REMOVE
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
ID_COMBINATION_MODE_ATTRIBUTE
Deprecated, for removal: This API element is subject to removal in a future version.In case of complex XML structures, combining can be done based on id.- See Also:
-
KEYS_COMBINATION_MODE_ATTRIBUTE
Deprecated, for removal: This API element is subject to removal in a future version.In case of complex XML structures, combining can be done based on keys. This is a comma separated list of attribute names.- See Also:
-
DEFAULT_SELF_COMBINATION_MODE
Deprecated, for removal: This API element is subject to removal in a future version.This default mode for combining a DOM node during merge means that where element names match, the process will try to merge the element attributes and values, rather than overriding the recessive element completely with the dominant one. This means that wherever the dominant element doesn't provide the value or a particular attribute, that value or attribute will be set from the recessive DOM node.- See Also:
-
-
Method Details
-
name
-
namespaceUri
-
prefix
-
value
-
attributes
-
attribute
Returns the value of a specific attribute.- Parameters:
name- the name of the attribute to retrieve- Returns:
- the attribute value, or
nullif the attribute doesn't exist - Throws:
NullPointerException- if name is null
-
children
-
child
-
inputLocation
-
getName
Deprecated, for removal: This API element is subject to removal in a future version. -
getNamespaceUri
Deprecated, for removal: This API element is subject to removal in a future version. -
getPrefix
Deprecated, for removal: This API element is subject to removal in a future version. -
getValue
Deprecated, for removal: This API element is subject to removal in a future version. -
getAttributes
Deprecated, for removal: This API element is subject to removal in a future version. -
getAttribute
@Deprecated(since="4.0.0", forRemoval=true) @Nullable default String getAttribute(@Nonnull String name) Deprecated, for removal: This API element is subject to removal in a future version. -
getChildren
Deprecated, for removal: This API element is subject to removal in a future version. -
getChild
Deprecated, for removal: This API element is subject to removal in a future version. -
getInputLocation
Deprecated, for removal: This API element is subject to removal in a future version. -
merge
Deprecated, for removal: This API element is subject to removal in a future version.useXmlService.merge(XmlNode, XmlNode, Boolean)instead -
merge
@Deprecated(since="4.0.0", forRemoval=true) default XmlNode merge(@Nullable XmlNode source, @Nullable Boolean childMergeOverride) Deprecated, for removal: This API element is subject to removal in a future version.useXmlService.merge(XmlNode, XmlNode, Boolean)instead -
merge
@Deprecated(since="4.0.0", forRemoval=true) @Nullable static XmlNode merge(@Nullable XmlNode dominant, @Nullable XmlNode recessive) Deprecated, for removal: This API element is subject to removal in a future version.useXmlService.merge(XmlNode, XmlNode, Boolean)insteadMerge recessive into dominant and return eitherdominantwith merged information or a clone ofrecessiveifdominantisnull.- Parameters:
dominant- the noderecessive- ifnull, nothing will happen- Returns:
- the merged node
-
merge
-
newInstance
Creates a new XmlNode instance with the specified name.- Parameters:
name- the name for the new node- Returns:
- a new XmlNode instance
- Throws:
NullPointerException- if name is null
-
newInstance
Creates a new XmlNode instance with the specified name and value.- Parameters:
name- the name for the new nodevalue- the value for the new node- Returns:
- a new XmlNode instance
- Throws:
NullPointerException- if name is null
-
newInstance
Creates a new XmlNode instance with the specified name and children.- Parameters:
name- the name for the new nodechildren- the list of child nodes- Returns:
- a new XmlNode instance
- Throws:
NullPointerException- if name is null
-
newInstance
static XmlNode newInstance(String name, String value, Map<String, String> attrs, List<XmlNode> children, Object location) Creates a new XmlNode instance with all properties specified.- Parameters:
name- the name for the new nodevalue- the value for the new nodeattrs- the attributes for the new nodechildren- the list of child nodeslocation- the input location information- Returns:
- a new XmlNode instance
- Throws:
NullPointerException- if name is null
-
newBuilder
Returns a new builder for creating XmlNode instances.- Returns:
- a new Builder instance
-
XmlService.merge(XmlNode, XmlNode, Boolean)instead