use of org.mycore.common.content.MCRJDOMContent in project mycore by MyCoRe-Org.
the class MCRNormalizeUnicodeTransformer method process.
public Document process(Document xml) throws IOException, JDOMException, SAXException {
if (stylesheet == null)
return xml.clone();
MCRContent source = new MCRJDOMContent(xml);
MCRContent transformed = MCRXSL2XMLTransformer.getInstance("xsl/" + stylesheet).transform(source);
MCRContent normalized = new MCRNormalizeUnicodeTransformer().transform(transformed);
return normalized.asXML();
}
use of org.mycore.common.content.MCRJDOMContent in project mycore by MyCoRe-Org.
the class MCRMailEventHandler method handleDerivateEvent.
private void handleDerivateEvent(MCREvent evt, MCRDerivate der) {
MCRContent xml = new MCRJDOMContent(der.createXML());
handleEvent(evt, xml, der.getId().toString());
}
use of org.mycore.common.content.MCRJDOMContent in project mycore by MyCoRe-Org.
the class MCRMailEventHandler method handleObjectEvent.
private void handleObjectEvent(MCREvent evt, MCRObject obj) {
MCRContent xml = new MCRJDOMContent(obj.createXML());
handleEvent(evt, xml, obj.getId().toString());
}
use of org.mycore.common.content.MCRJDOMContent in project mycore by MyCoRe-Org.
the class MCRMailEventHandler method handlePathEvent.
private void handlePathEvent(MCREvent evt, Path file, BasicFileAttributes attrs) {
if (!(file instanceof MCRPath)) {
return;
}
MCRPath path = MCRPath.toMCRPath(file);
MCRContent xml;
try {
xml = new MCRJDOMContent(MCRPathXML.getFileXML(path, attrs));
handleEvent(evt, xml, path.toString());
} catch (IOException e) {
LOGGER.error("Error while generating mail for {}", file, e);
}
}
use of org.mycore.common.content.MCRJDOMContent in project mycore by MyCoRe-Org.
the class MCRXSL2XMLTransformer method getTransformedContent.
@Override
protected MCRContent getTransformedContent(MCRContent source, XMLReader reader, TransformerHandler transformerHandler) throws IOException, SAXException {
JDOMResult result = new JDOMResult();
transformerHandler.setResult(result);
// Parse the source XML, and send the parse events to the
// TransformerHandler.
reader.parse(source.getInputSource());
Document resultDoc = getDocument(result);
if (resultDoc == null) {
throw new MCRConfigurationException("Stylesheets " + Arrays.asList(templateSources) + " does not return any content for " + source.getSystemId());
}
return new MCRJDOMContent(resultDoc);
}
Aggregations