org.gradle.plugins.ide.api

## Class XmlFileContentMerger

- java.lang.Object
- - groovy.lang.GroovyObjectSupport
  - - org.gradle.plugins.ide.api.FileContentMerger
    - - org.gradle.plugins.ide.api.XmlFileContentMerger

- All Implemented Interfaces:
    GroovyObject
  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.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XmlFileContentMerger(org.gradle.internal.xml.XmlTransformer xmlTransformer)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.gradle.internal.xml.XmlTransformer` | `getXmlTransformer()`
    `void` | `setXmlTransformer(org.gradle.internal.xml.XmlTransformer xmlTransformer)`
    `void` | `withXml(Action<? super XmlProvider> action)` Adds an action to be called when the file has been created.
    `void` | `withXml(Closure closure)` Adds a closure to be called when the file has been created.

    - ### Methods inherited from class org.gradle.plugins.ide.api.FileContentMerger

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

    - ### Methods inherited from class groovy.lang.GroovyObjectSupport

      `getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### XmlFileContentMerger

          public XmlFileContentMerger(org.gradle.internal.xml.XmlTransformer xmlTransformer)

  - ### Method Detail

    - #### getXmlTransformer

          public org.gradle.internal.xml.XmlTransformer getXmlTransformer()

    - #### setXmlTransformer

          public void setXmlTransformer(org.gradle.internal.xml.XmlTransformer xmlTransformer)

    - #### withXml

          public void withXml(Closure closure)

      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.

    - #### withXml

          @Incubating
          public void withXml(Action<? super XmlProvider> action)

      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.