package jetbrains.mps.build.mps.runtime.anttask;
/*Generated by MPS */
import org.apache.tools.ant.util.XMLFragment;
import java.io.OutputStream;
import java.io.IOException;
import org.apache.tools.ant.util.DOMElementWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import java.io.ByteArrayOutputStream;
import org.apache.tools.ant.BuildException;
public class ModuleXml extends XMLFragment {
private String myModuleRef = "";
private String myModuleXmlPath = "";
private String myInnerText = null;
public ModuleXml() {
}
public void setRef(String ref) {
myModuleRef = ref;
}
public void setDestfile(String dest) {
myModuleXmlPath = dest;
}
public String getRef() {
return myModuleRef;
}
public String getDestfile() {
return myModuleXmlPath;
}
private void writeInnerText(OutputStream os, int indent, String indentWith) throws IOException {
DOMElementWriter writer = new DOMElementWriter(false);
Writer wr = new OutputStreamWriter(os);
for (Node node = getFragment().getFirstChild(); node != null; node = node.getNextSibling()) {
if (node instanceof Element) {
writer.write((Element) node, wr, indent, indentWith);
}
}
wr.flush();
}
public void setInnerText(String innerText) {
myInnerText = innerText;
}
public String getInnerText(int indent, String indentWith) {
if (myInnerText != null) {
return myInnerText;
}
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
writeInnerText(os, indent, indentWith);
os.close();
return os.toString();
} catch (IOException e) {
throw new BuildException(e);
}
}
}