use of iso.std.iso._20022.tech.xsd.pain_001_001.Document in project mycore by MyCoRe-Org.
the class MCRBase method createXML.
/**
* This method create a XML stream for all object data.
*
* @exception MCRException
* if the content of this class is not valid
* @return a JDOM Document with the XML data of the object as byte array
*/
public Document createXML() throws MCRException {
validate();
Element elm = new Element(getRootTagName());
Document doc = new Document(elm);
elm.addNamespaceDeclaration(XSI_NAMESPACE);
elm.addNamespaceDeclaration(XLINK_NAMESPACE);
elm.setAttribute("noNamespaceSchemaLocation", mcr_schema, XSI_NAMESPACE);
elm.setAttribute("ID", mcr_id.toString());
if (mcr_label != null) {
elm.setAttribute("label", mcr_label);
}
elm.setAttribute("version", mcr_version);
return doc;
}
use of iso.std.iso._20022.tech.xsd.pain_001_001.Document in project mycore by MyCoRe-Org.
the class MCRDerivate method createXML.
/**
* This methode create a XML stream for all object data.
*
* @exception MCRException
* if the content of this class is not valid
* @return a JDOM Document with the XML data of the object as byte array
*/
@Override
public final org.jdom2.Document createXML() throws MCRException {
Document doc = super.createXML();
Element elm = doc.getRootElement();
elm.addContent(mcr_derivate.createXML());
elm.addContent(mcr_service.createXML());
return doc;
}
use of iso.std.iso._20022.tech.xsd.pain_001_001.Document in project mycore by MyCoRe-Org.
the class MCRStoreBrowserRequest method buildResponseXML.
/**
* Builds the xml output to be rendered as response
*/
Document buildResponseXML() throws Exception {
File dir = getRequestedDirectory();
String[] children = dir.list();
Element xml = new Element("storeBrowser");
if (children != null)
for (String child : children) {
xml.addContent(buildXML(child));
}
return new Document(xml);
}
use of iso.std.iso._20022.tech.xsd.pain_001_001.Document in project mycore by MyCoRe-Org.
the class MCRFileCollection method readAdditionalData.
private void readAdditionalData() throws IOException {
FileObject src = VFS.getManager().resolveFile(fo, dataFile);
if (!src.exists()) {
LOGGER.warn("Metadata file is missing, repairing metadata...");
data = new Element("collection");
new Document(data);
repairMetadata();
}
try {
data = new MCRVFSContent(src).asXML().getRootElement();
} catch (JDOMException | SAXException e) {
throw new IOException(e);
}
}
use of iso.std.iso._20022.tech.xsd.pain_001_001.Document in project mycore by MyCoRe-Org.
the class MCRXSLTransformationTest method transform.
@Test
public void transform() {
Element root = new Element("root");
Document in = new Document(root);
root.addContent(new Element("child").setAttribute("hasChildren", "no"));
Document out = MCRXSLTransformation.transform(in, stylesheet.getAbsolutePath());
assertTrue("Input not the same as Output", MCRXMLHelper.deepEqual(in, out));
}
Aggregations