Class XmlService

java.lang.Object
org.apache.maven.api.xml.XmlService

public abstract class XmlService extends Object
Comprehensive service interface for XML operations including node creation, merging, reading, and writing.

This class provides XML merging functionality for Maven's XML handling and specifies the combination modes that control how XML elements are merged.

The merger supports two main types of combinations:

  • Children combination: Controls how child elements are combined
  • Self combination: Controls how the element itself is combined

Children combination modes (specified by combine.children attribute):

  • merge (default): Merges elements with matching names
  • append: Adds elements as siblings

Self combination modes (specified by combine.self attribute):

  • merge (default): Merges attributes and values
  • override: Completely replaces the element
  • remove: Removes the element

For complex XML structures, combining can also be done based on:

  • ID: Using the combine.id attribute
  • Keys: Using the combine.keys attribute with comma-separated key names
Since:
4.0.0
  • Field Details

    • CHILDREN_COMBINATION_MODE_ATTRIBUTE

      public static final String CHILDREN_COMBINATION_MODE_ATTRIBUTE
      Attribute name controlling how child elements are combined
      See Also:
    • CHILDREN_COMBINATION_MERGE

      public static final String CHILDREN_COMBINATION_MERGE
      Value indicating children should be merged based on element names
      See Also:
    • CHILDREN_COMBINATION_APPEND

      public static final String CHILDREN_COMBINATION_APPEND
      Value indicating children should be appended as siblings
      See Also:
    • DEFAULT_CHILDREN_COMBINATION_MODE

      public static final String DEFAULT_CHILDREN_COMBINATION_MODE
      Default mode for combining children DOMs during merge. When element names match, the process will try to merge the element data, rather than putting the dominant and recessive elements as siblings.
      See Also:
    • SELF_COMBINATION_MODE_ATTRIBUTE

      public static final String SELF_COMBINATION_MODE_ATTRIBUTE
      Attribute name controlling how the element itself is combined
      See Also:
    • SELF_COMBINATION_OVERRIDE

      public static final String SELF_COMBINATION_OVERRIDE
      Value indicating the element should be completely overridden
      See Also:
    • SELF_COMBINATION_MERGE

      public static final String SELF_COMBINATION_MERGE
      Value indicating the element should be merged
      See Also:
    • SELF_COMBINATION_REMOVE

      public static final String SELF_COMBINATION_REMOVE
      Value indicating the element should be removed
      See Also:
    • DEFAULT_SELF_COMBINATION_MODE

      public static final String DEFAULT_SELF_COMBINATION_MODE
      Default mode for combining a DOM node during merge. When element names match, the process will try to merge element attributes and values, rather than overriding the recessive element completely.
      See Also:
    • ID_COMBINATION_MODE_ATTRIBUTE

      public static final String ID_COMBINATION_MODE_ATTRIBUTE
      Attribute name for ID-based combination mode
      See Also:
    • KEYS_COMBINATION_MODE_ATTRIBUTE

      public static final String KEYS_COMBINATION_MODE_ATTRIBUTE
      Attribute name for key-based combination mode. Value should be a comma-separated list of attribute names.
      See Also:
  • Constructor Details

    • XmlService

      public XmlService()
  • Method Details