}
// Second pass through the data. The goal of this pass is to
// remove any things we added in NixNote that do not match
// the ENML schema
XMLCleanup v = new XMLCleanup();
v.setValue(newContent);
logger.log(logger.HIGH, "Beginning ENML Cleanup");
v.validate();
logger.log(logger.HIGH, "Cleanup complete.");
// Final pass through the data. In this one we
// remove any invalid attributes and to save the
// new resources.
logger.log(logger.EXTREME, "Rebuilt ENML:");
logger.log(logger.EXTREME, v.getValue());
logger.log(logger.EXTREME, "End Of Rebuilt ENML:");
resources = v.getResources();
// The XML has the dtd to validate set against Evernote's web
// address. We change it to a local one because otherwise it would
// fail if the user doesn't have internet connectivity. The local copy
// also contains the 3 other PUBLIC definitions at the beginning of the dtd.
newContent = v.getValue();
File dtdFile = Global.getFileManager().getXMLDirFile("enml2.dtd");
String dtd = dtdFile.toURI().toString();
newContent = newContent.replace("<!DOCTYPE en-note SYSTEM \'http://xml.evernote.com/pub/enml2.dtd'>",
"<!DOCTYPE en-note SYSTEM \"" +dtd +"\">");