private static void putDtdReference(String dtdFileName, String outputXmlFileName) throws IOException {
RandomAccessFile xml = new RandomAccessFile(outputXmlFileName, "rw");
int beginIndex = Math.max(dtdFileName.lastIndexOf("/"), dtdFileName.lastIndexOf(File.separator));
String rootElementName = dtdFileName.substring(beginIndex+1, dtdFileName.lastIndexOf(".dtd"));
String dtdReference = "<!DOCTYPE "+rootElementName+" SYSTEM \'"+dtdFileName+"\'>"+'\n';
xml.readLine();
long posicao = xml.getFilePointer();
String aux1 = xml.readLine();
xml.seek(posicao);
xml.writeBytes(dtdReference);
do {