Package org.apache.maven.internal.xml
Class XmlNodeImpl
java.lang.Object
org.apache.maven.internal.xml.XmlNodeImpl
- All Implemented Interfaces:
Serializable
,XmlNode
NOTE: remove all the util code in here when separated, this class should be pure data.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Object
protected final String
protected final String
Fields inherited from interface org.apache.maven.api.xml.XmlNode
CHILDREN_COMBINATION_APPEND, CHILDREN_COMBINATION_MERGE, CHILDREN_COMBINATION_MODE_ATTRIBUTE, DEFAULT_CHILDREN_COMBINATION_MODE, DEFAULT_SELF_COMBINATION_MODE, ID_COMBINATION_MODE_ATTRIBUTE, KEYS_COMBINATION_MODE_ATTRIBUTE, SELF_COMBINATION_MERGE, SELF_COMBINATION_MODE_ATTRIBUTE, SELF_COMBINATION_OVERRIDE, SELF_COMBINATION_REMOVE
-
Constructor Summary
ConstructorDescriptionXmlNodeImpl
(String name) XmlNodeImpl
(String name, String value) XmlNodeImpl
(String name, String value, Map<String, String> attributes, List<XmlNode> children, Object location) XmlNodeImpl
(XmlNode from, String name) -
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
getAttribute
(String name) int
getName()
getValue()
int
hashCode()
static XmlNode
Merge two DOMs, with one having dominance in the case of collision.static XmlNode
Merges one DOM into another, given a specific algorithm and possible override points for that algorithm.toString()
void
writeToSerializer
(String namespace, org.codehaus.plexus.util.xml.pull.XmlSerializer serializer)
-
Field Details
-
name
-
value
-
attributes
-
children
-
location
-
-
Constructor Details
-
XmlNodeImpl
-
XmlNodeImpl
-
XmlNodeImpl
-
XmlNodeImpl
-
-
Method Details
-
merge
-
clone
-
getName
-
getValue
-
getAttributes
- Specified by:
getAttributes
in interfaceXmlNode
-
getAttribute
- Specified by:
getAttribute
in interfaceXmlNode
-
getChild
-
getChildren
- Specified by:
getChildren
in interfaceXmlNode
-
getChildCount
public int getChildCount() -
getInputLocation
- Specified by:
getInputLocation
in interfaceXmlNode
- Returns:
- input location
- Since:
- 3.2.0
-
writeToSerializer
public void writeToSerializer(String namespace, org.codehaus.plexus.util.xml.pull.XmlSerializer serializer) throws IOException - Throws:
IOException
-
merge
Merges one DOM into another, given a specific algorithm and possible override points for that algorithm.The algorithm is as follows:
- if the recessive DOM is null, there is nothing to do... return.
- Determine whether the dominant node will suppress the recessive one (flag=mergeSelf).
- retrieve the 'combine.self' attribute on the dominant node, and try to match against 'override'... if it matches 'override', then set mergeSelf == false...the dominant node suppresses the recessive one completely.
- otherwise, use the default value for mergeSelf, which is true...this is the same as specifying 'combine.self' == 'merge' as an attribute of the dominant root node.
- If mergeSelf == true
- Determine whether children from the recessive DOM will be merged or appended to the dominant DOM as
siblings (flag=mergeChildren).
- if childMergeOverride is set (non-null), use that value (true/false)
- retrieve the 'combine.children' attribute on the dominant node, and try to match against 'append'...
- if it matches 'append', then set mergeChildren == false...the recessive children will be appended as siblings of the dominant children.
- otherwise, use the default value for mergeChildren, which is true...this is the same as specifying 'combine.children' == 'merge' as an attribute on the dominant root node.
- Iterate through the recessive children, and:
- if mergeChildren == true and there is a corresponding dominant child (matched by element name), merge the two.
- otherwise, add the recessive child as a new child on the dominant root node.
- Determine whether children from the recessive DOM will be merged or appended to the dominant DOM as
siblings (flag=mergeChildren).
-
merge
Merge two DOMs, with one having dominance in the case of collision. Merge mechanisms (vs. override for nodes, or vs. append for children) is determined by attributes of the dominant root node.- Parameters:
dominant
- The dominant DOM into which the recessive value/attributes/children will be mergedrecessive
- The recessive DOM, which will be merged into the dominant DOM- Returns:
- merged DOM
- See Also:
-
equals
-
hashCode
public int hashCode() -
toString
-
toUnescapedString
-