net.sweetohm.ant.xml
Class MergeTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by net.sweetohm.ant.util.FileTask
              extended by net.sweetohm.ant.xml.MergeTask
All Implemented Interfaces:
java.lang.Cloneable

public class MergeTask
extends FileTask

This task merge XML files in a single file (see documentation for more details.

Version:
1.0
Author:
Michel CASABIANCA

Field Summary
(package private) static java.lang.String defaultToFile
          Default generated file
(package private)  java.lang.String doctype
          The resulting document doctype
(package private)  java.lang.String encoding
          The resulting document encoding
(package private)  java.lang.String guessedEncoding
          Guessed resulting document encoding (from first file)
(package private)  boolean nestingElement
          Indicates if a nesting element is necessary
(package private)  java.lang.String nestingElementName
          Nesting element name
(package private)  java.io.File tofile
          The destination file
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
MergeTask()
           
 
Method Summary
 void execute()
          The method to launch the program as an Ant task.
(package private)  java.lang.String extract(java.lang.String content)
          Extract the root element from the file content
(package private)  java.lang.String processFile(java.io.File file)
          Process a single file
 void setDoctype(java.lang.String doctype)
          Doctype setter.
 void setEncoding(java.lang.String encoding)
          Encoding setter.
 void setNestingElement(boolean nestingElement)
          Indicate if a nesting element is necessary.
 void setNestingElementName(java.lang.String nestingElementName)
          Indicate the name of the nesting element.
 void setTofile(java.lang.String tofile)
          Destination file setter.
 
Methods inherited from class net.sweetohm.ant.util.FileTask
addFileset, getFiles, setDir, setFile
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tofile

java.io.File tofile
The destination file


encoding

java.lang.String encoding
The resulting document encoding


guessedEncoding

java.lang.String guessedEncoding
Guessed resulting document encoding (from first file)


doctype

java.lang.String doctype
The resulting document doctype


defaultToFile

static final java.lang.String defaultToFile
Default generated file

See Also:
Constant Field Values

nestingElement

boolean nestingElement
Indicates if a nesting element is necessary


nestingElementName

java.lang.String nestingElementName
Nesting element name

Constructor Detail

MergeTask

public MergeTask()
Method Detail

setTofile

public void setTofile(java.lang.String tofile)
Destination file setter.

Parameters:
tofile - The destination file.

setEncoding

public void setEncoding(java.lang.String encoding)
Encoding setter.

Parameters:
encoding - The encoding of the XML files

setDoctype

public void setDoctype(java.lang.String doctype)
Doctype setter.

Parameters:
doctype - The doctype of the XML file.

setNestingElement

public void setNestingElement(boolean nestingElement)
Indicate if a nesting element is necessary.

Parameters:
nestingElement -

setNestingElementName

public void setNestingElementName(java.lang.String nestingElementName)
Indicate the name of the nesting element.

Parameters:
nestingElementName -

execute

public void execute()
The method to launch the program as an Ant task.

Overrides:
execute in class org.apache.tools.ant.Task

processFile

java.lang.String processFile(java.io.File file)
                       throws java.io.IOException
Process a single file

Parameters:
file - The file to process
Throws:
java.io.IOException

extract

java.lang.String extract(java.lang.String content)
Extract the root element from the file content

Parameters:
content - The content of the file