# Class XmlFileContentMerger

java.lang.Object
org.gradle.plugins.ide.api.FileContentMerger
org.gradle.plugins.ide.api.XmlFileContentMerger

Direct Known Subclasses:
  `IdeaModuleIml`

public class XmlFileContentMerger extends FileContentMerger
Models the generation/parsing/merging capabilities. Adds XML-related hooks.

For examples see docs for `EclipseProject` or `IdeaProject` and others.

Since:
  1.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `XmlFileContentMerger(org.gradle.internal.xml.XmlTransformer xmlTransformer)`
  Creates a new `XmlFileContentMerger`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `org.gradle.internal.xml.XmlTransformer`
  `getXmlTransformer()`
  Deprecated.
  Will be removed in Gradle 10.
  `void`
  `setXmlTransformer(org.gradle.internal.xml.XmlTransformer xmlTransformer)`
  Deprecated.
  Will be removed in Gradle 10.
  `void`
  `withXml(Closure closure)`
  Deprecated.
  Will be removed in Gradle 10.
  `void`
  `withXml(Action<? super XmlProvider> action)`
  Deprecated.
  Will be removed in Gradle 10.

  ### Methods inherited from class FileContentMerger

  `beforeMerged, beforeMerged, getBeforeMerged, getWhenMerged, setBeforeMerged, setWhenMerged, whenMerged, whenMerged`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### XmlFileContentMerger

    public XmlFileContentMerger(org.gradle.internal.xml.XmlTransformer xmlTransformer)
    Creates a new `XmlFileContentMerger`.
    Since:
      1.0

- ## Method Details

  - ### getXmlTransformer

    @Deprecated public org.gradle.internal.xml.XmlTransformer getXmlTransformer()
    Deprecated.
    Will be removed in Gradle 10.
    The transformer that the `withXml` actions are registered on.
    Since:
      1.0

  - ### setXmlTransformer

    @Deprecated public void setXmlTransformer(org.gradle.internal.xml.XmlTransformer xmlTransformer)
    Deprecated.
    Will be removed in Gradle 10.
    Sets the transformer.
    Since:
      1.0

  - ### withXml

    @Deprecated public void withXml(@DelegatesTo(XmlProvider.class) Closure closure)
    Deprecated.
    Will be removed in Gradle 10.
    Adds a closure to be called when the file has been created. The XML is passed to the closure as a parameter in form of a `XmlProvider`. The closure can modify the XML before it is written to the output file.

    For examples see docs for `EclipseProject` or `IdeaProject` and others.

    Parameters:
      `closure` - The closure to execute when the XML has been created.
    Since:
      1.0

  - ### withXml

    @Deprecated public void withXml(Action<? super XmlProvider> action)
    Deprecated.
    Will be removed in Gradle 10.
    Adds an action to be called when the file has been created.

    See `withXml(Closure)`

    Parameters:
      `action` - The action to execute when the XML has been created.
    Since:
      2.14