Revision 838422b2
Added by Anahit Babadshanjan almost 15 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/jaxb/CdmDocumentBuilder.java | ||
---|---|---|
47 | 47 |
/** |
48 | 48 |
* Initializes a JaxbContext with one class (eu.etaxonomy.cdm.model.DataSet). |
49 | 49 |
* |
50 |
* @author a.babadshanjan |
|
50 |
* @author a.babadshanjan, ben.clark
|
|
51 | 51 |
*/ |
52 | 52 |
//Binds it to XML schemas found in /src/main/resources/schema/cdm (cdm.xsd, common.xsd, name.xsd). |
53 | 53 |
//There is a bit of magic with a resource resolver in eu.etaxonomy.cdm.io.jaxb |
... | ... | |
101 | 101 |
schema = schemaFactory.newSchema(sources); |
102 | 102 |
} |
103 | 103 |
|
104 |
protected void contstructUnmarshaller() throws ParserConfigurationException, SAXException, JAXBException {
|
|
104 |
protected void constructUnmarshaller() throws ParserConfigurationException, SAXException, JAXBException { |
|
105 | 105 |
unmarshaller = jaxbContext.createUnmarshaller(); |
106 | 106 |
unmarshaller.setSchema(schema); |
107 | 107 |
|
... | ... | |
125 | 125 |
|
126 | 126 |
jaxbContext = JAXBContext.newInstance(getContextClasses()); |
127 | 127 |
|
128 |
contstructUnmarshaller();
|
|
128 |
constructUnmarshaller(); |
|
129 | 129 |
constructMarshaller(); |
130 | 130 |
} |
131 | 131 |
|
... | ... | |
136 | 136 |
|
137 | 137 |
// For test purposes insert newlines to make the XML output readable |
138 | 138 |
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, formattedOutput); |
139 |
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION,"http://etaxonomy.eu/cdm/model/1.0 schema/cdm/cdm.xsd"); |
|
139 |
// marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION,"http://etaxonomy.eu/cdm/model/1.0 schema/cdm/cdm.xsd"); |
|
140 |
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION,"http://etaxonomy.eu/cdm/model/1.0 cdm.xsd"); |
|
140 | 141 |
marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding); |
141 | 142 |
|
142 | 143 |
CdmMarshallerListener marshallerListener = new CdmMarshallerListener(); |
... | ... | |
151 | 152 |
|
152 | 153 |
jaxbContext = JAXBContext.newInstance(getContextClasses()); |
153 | 154 |
|
154 |
contstructUnmarshaller();
|
|
155 |
constructUnmarshaller(); |
|
155 | 156 |
constructMarshaller(); |
156 | 157 |
} |
157 | 158 |
|
... | ... | |
190 | 191 |
|
191 | 192 |
} |
192 | 193 |
|
193 |
// can only be used with JAXB 2.1 |
|
194 |
// public void writeFile(DataSet dataSet, File file) throws JAXBException { |
|
194 |
// public void marshal(DataSet dataSet, File file) throws JAXBException { |
|
195 | 195 |
// marshaller.marshal(dataSet, file); |
196 | 196 |
// } |
197 | 197 |
|
Also available in: Unified diff
JAXB export/import cleanup