public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) {
String content = XPathHelper.getNodeValue("/CONTENT/BODY/TEXT", descriptor);
String title = XPathHelper.getNodeValue("/CONTENT/TITLE/@value", descriptor).trim().replaceAll("\\<.*?\\>", "").replaceAll("/", "_");
int priority = Integer.parseInt(((Element)resourceNode).getAttribute("priority"));
content.replaceAll(""", "\"");
contextPath = contextPath + title;
if (!XPathHelper.selectNode("/CONTENT/FILES", descriptor).hasChildNodes()) {
TextDocument text = new TextDocument();
text.setContent(content);
text.setTitle(title);
text.setContextPath(contextPath);
text.setSequenceNum(priority);
return text;
}
else {
Folder folder = new Folder();
folder.setDescription(content);
folder.setTitle(title);
folder.setPath(contextPath);
folder.setSequenceNum(priority);
return folder;
}
}