Reverted change that filename inside xml always matches that actual
filename.
This commit is contained in:
2013-09-30 08:38:12 +02:00
parent 858d8dbd45
commit 81af4449dc
2 changed files with 23 additions and 23 deletions

View File

@@ -47,7 +47,7 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import ch.psi.fda.model.v1.Configuration;
import ch.psi.fda.model.v1.Data;
//import ch.psi.fda.model.v1.Data;
/**
* Manage the serialization and deserialization of the model
@@ -113,13 +113,13 @@ public class ModelManager {
try{
Configuration model = (Configuration) u.unmarshal(bsource, Configuration.class).getValue();
// Ensure that the filename inside the xml file is always the file name
Data d = model.getData();
if(d==null){
d = new Data();
model.setData(d);
}
d.setFileName(file.getName().replaceAll("\\.xml$", ""));
// // Ensure that the filename inside the xml file is always the file name
// Data d = model.getData();
// if(d==null){
// d = new Data();
// model.setData(d);
// }
// d.setFileName(file.getName().replaceAll("\\.xml$", ""));
return (model);
}
@@ -153,13 +153,13 @@ public class ModelManager {
try{
Configuration model = (Configuration) u.unmarshal(new StreamSource(file), Configuration.class).getValue();
// Ensure that the filename inside the xml file is always the file name
Data d = model.getData();
if(d==null){
d = new Data();
model.setData(d);
}
d.setFileName(file.getName().replaceAll("\\.xml$", ""));
// // Ensure that the filename inside the xml file is always the file name
// Data d = model.getData();
// if(d==null){
// d = new Data();
// model.setData(d);
// }
// d.setFileName(file.getName().replaceAll("\\.xml$", ""));
return (model);
}
@@ -192,13 +192,13 @@ public class ModelManager {
Schema schema = sf.newSchema(new Source[]{s}); // Use schema reference provided in XML
m.setSchema(schema);
// Set scan name equal to file name
Data d = model.getData();
if(d==null){
d = new Data();
model.setData(d);
}
d.setFileName(file.getName().replaceAll("\\.xml$", ""));
// // Set scan name equal to file name
// Data d = model.getData();
// if(d==null){
// d = new Data();
// model.setData(d);
// }
// d.setFileName(file.getName().replaceAll("\\.xml$", ""));
m.marshal( new JAXBElement<Configuration>(qname, Configuration.class, model ), file);
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.psi.ch/~ebner/models/scan/1.0" numberOfExecution="1" failOnSensorError="true">
<data format="txt" fileName="scan1d"/>
<data format="txt" fileName="scan1d_plus_bla"/>
<scan>
<dimension zigzag="true">
<positioner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="LinearPositioner" name="MTEST-HW3:MOT1" settlingTime="0.1" doneValue="1" doneDelay="0.0" id="id0">