use of com.axelor.apps.bankpayment.xsd.sepa.pain_008_001_01.Document in project plexus-containers by codehaus-plexus.
the class ComponentsXmlMerger method merge.
/**
* @see Merger#merge(Document, Document)
*/
public Document merge(Document dDocument, Document rDocument) throws MergeException {
// TODO: Ideally we don't want to manipulate the original
// dominant document but use its copy for merge.
// Document mDoc = (Document) dDocument.clone(); // doesn't merge properly
Document mDoc = dDocument;
ComponentSetElement dCSE = new ComponentSetElement(mDoc.getRootElement());
ComponentSetElement rCSE = new ComponentSetElement(rDocument.getRootElement());
dCSE.merge(rCSE);
// the contents are merged into the dominant document DOM.
return mDoc;
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_008_001_01.Document in project plexus-containers by codehaus-plexus.
the class PlexusXmlMerger method merge.
/**
* {@inheritDoc}
*/
public Document merge(Document dDocument, Document rDocument) throws MergeException {
// TODO: Ideally we don't want to manipulate the original
// dominant document but use its copy for merge.
// Document mDoc = (Document) dDocument.clone(); // doesn't merge properly
Document mDoc = dDocument;
PlexusRootElement dCSE = new PlexusRootElement(mDoc.getRootElement());
PlexusRootElement rCSE = new PlexusRootElement(rDocument.getRootElement());
dCSE.merge(rCSE);
// the contents are merged into the dominant document DOM.
return mDoc;
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_008_001_01.Document in project Squid by CIRDLES.
the class CommonPbXMLConverterTest method testCommonPbXMLConverter.
@Test
public void testCommonPbXMLConverter() {
try {
ResourceExtractor extractor = new ResourceExtractor(CommonPbModel.class);
File initialFile = extractor.extractResourceAsFile("Stacey-Kramers@559.0Ma (z6266) v.1.0.xml");
CommonPbModel model = new CommonPbModel();
model = (CommonPbModel) model.readXMLObject(initialFile.getAbsolutePath(), false);
File convertedFile = new File("commonPbCopy.xml");
model.serializeXMLObject(convertedFile.getAbsolutePath());
model = (CommonPbModel) model.readXMLObject(convertedFile.getAbsolutePath(), false);
File convertedConvertedFile = new File("commonPbCopyOfCopy.xml");
model.serializeXMLObject(convertedConvertedFile.getAbsolutePath());
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(convertedFile);
Element initialElement = doc.getRootElement();
doc = builder.build(convertedConvertedFile);
Element convertedElement = doc.getRootElement();
convertedFile.delete();
convertedConvertedFile.delete();
assertTrue(ElementComparer.compareElements(initialElement, convertedElement));
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_008_001_01.Document in project Squid by CIRDLES.
the class PhysicalConstantsModelXMLConverterTest method testPhysicalConstantsXMLConverter.
@Test
public void testPhysicalConstantsXMLConverter() {
try {
ResourceExtractor extractor = new ResourceExtractor(PhysicalConstantsModel.class);
File initialFile = extractor.extractResourceAsFile("EARTHTIME Physical Constants Model v.1.1.xml");
PhysicalConstantsModel model = (PhysicalConstantsModel) (new PhysicalConstantsModel()).readXMLObject(initialFile.getAbsolutePath(), false);
File convertedFile = new File("physicalConstantsCopy.xml");
model.serializeXMLObject(convertedFile.getAbsolutePath());
model = (PhysicalConstantsModel) model.readXMLObject(convertedFile.getAbsolutePath(), false);
File convertedConvertedFile = new File("physicalConstantsCopyOfCopy.xml");
model.serializeXMLObject(convertedConvertedFile.getAbsolutePath());
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(convertedFile);
Element initialElement = doc.getRootElement();
doc = builder.build(convertedConvertedFile);
Element convertedElement = doc.getRootElement();
convertedFile.delete();
convertedConvertedFile.delete();
assertTrue(ElementComparer.compareElements(initialElement, convertedElement));
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of com.axelor.apps.bankpayment.xsd.sepa.pain_008_001_01.Document in project Squid by CIRDLES.
the class ReferenceMaterialXMlConverterTest method testReferenceMaterialXMLConverter.
@Test
public void testReferenceMaterialXMLConverter() {
try {
ResourceExtractor extractor = new ResourceExtractor(ReferenceMaterialModel.class);
File initialFile = extractor.extractResourceAsFile("z6266 ID-TIMS (559.0 Ma) v.1.0.xml");
ParametersModel model = (ReferenceMaterialModel) (new ReferenceMaterialModel()).readXMLObject(initialFile.getAbsolutePath(), false);
File convertedFile = new File("zirconCopy.xml");
model.serializeXMLObject(convertedFile.getAbsolutePath());
model = (ReferenceMaterialModel) model.readXMLObject(convertedFile.getAbsolutePath(), false);
File convertedConvertedFile = new File("zirconCopyOfCopy.xml");
model.serializeXMLObject(convertedConvertedFile.getAbsolutePath());
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(convertedFile);
Element initialElement = doc.getRootElement();
doc = builder.build(convertedConvertedFile);
Element convertedElement = doc.getRootElement();
convertedFile.delete();
convertedConvertedFile.delete();
assertTrue(ElementComparer.compareElements(initialElement, convertedElement));
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
Aggregations