diff --git a/rtd_yeastx/build/build.xml b/rtd_yeastx/build/build.xml index 304d58a568cf85c509606dcc5503a700eb97ef13..cc46a042d371a175703ec00564091982db0c58b4 100644 --- a/rtd_yeastx/build/build.xml +++ b/rtd_yeastx/build/build.xml @@ -27,6 +27,7 @@ </fileset> <fileset dir="source"> <include name="**/*.sql" /> + <include name="**/*.xsd" /> </fileset> </recursive-jar> </target> diff --git a/rtd_yeastx/resource/examples/allFields.quantML b/rtd_yeastx/resource/examples/allFields.quantML index 58b62984f0fb119ecf86f4ca5ce647feaa8b70b0..8b6a654ad55f3b976fac7f588c546e6a3fff8520 100644 --- a/rtd_yeastx/resource/examples/allFields.quantML +++ b/rtd_yeastx/resource/examples/allFields.quantML @@ -2,8 +2,8 @@ <quantML> <msQuantification> <source>msSoft</source> - <valid>true</valid> <comment>no comment</comment> + <valid>true</valid> <registrationDate>04-Apr-1980 12:00:21</registrationDate> <registrator>John Doe</registrator> <concentration> diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLParser.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLParser.java index 3fed98618f82c83fee3a9389ea88f5dd6704c57c..02c8cfd25b0a44146737c8f3f7bd4d21e579f8ae 100644 --- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLParser.java +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLParser.java @@ -17,16 +17,23 @@ package ch.systemsx.cisd.yeastx.quant; import java.io.File; +import java.io.FileReader; import java.io.IOException; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.SchemaOutputResolver; import javax.xml.bind.Unmarshaller; +import javax.xml.bind.UnmarshallerHandler; import javax.xml.transform.Result; import javax.xml.transform.stream.StreamResult; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; +import ch.systemsx.cisd.common.utilities.XMLInfraStructure; import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationsDTO; /** @@ -46,6 +53,9 @@ class QuantMLParser private QuantMLParser() { this.unmarshaller = createUnmarshaller(); + unmarshaller.setSchema(XMLInfraStructure.createSchema("/" + + QuantMLParser.class.getPackage().getName().replace('.', '/') + + "/quantml-schema.xsd")); } private static Unmarshaller createUnmarshaller() @@ -90,7 +100,7 @@ class QuantMLParser throw new IllegalArgumentException("Wrong type: " + object); } return (MSQuantificationsDTO) object; - } catch (JAXBException ex) + } catch (Exception ex) { throw CheckedExceptionTunnel.wrapIfNecessary(ex); }