我有一个解组方法:
public static Object unmarshalXmlTo0100(String xmlMsg, String destination, String resource) throws Exception {
//init unmarshaller
ByteArrayInputStream input = new ByteArrayInputStream(xmlMsg.getBytes());
JAXBContext context = JAXBContext.newInstance(destination);
Unmarshaller unmarshaller = context.createUnmarshaller();
//init schema
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(XmlParser.class.getClassLoader().getResource(resource));
unmarshaller.setSchema(schema);
//unmarschal
Object data = unmarshaller.unmarshal(input);
//return message
return data;
}
现在由于某种原因,当我使用以下方法调用该方法时:
processDataObj = MainXMLParser.unmarshalXmlTo0100(processData, "cp.jaxb.planningBericht.classes", "source/xml/cp_md_format_planningBericht.xsd");
一切顺利。
但是当我使用以下内容时:
processDataObj = MainXMLParser.unmarshalXmlTo0100(processData, "cp.jaxb.beschikbaarheidBericht.classes", "source/xml/cp_md_format_beschikbaarheidBericht.xsd");
解组器不返回任何内容,但它会继续运行,因此 proccesDataObj 是空的......
我不知道出了什么问题...