public <T> void writeOut(T node, Class<T> declaredType) throws JAXBException {
try {
if (this.context == null) {
init();
}
Marshaller marshaller = this.context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.setProperty(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, SCHEMA_LOCATION);
marshaller.marshal(new JAXBElement(
new QName(declaredType.getDeclaredAnnotation(XmlType.class).name()), declaredType, node),
new File(xmlPath));
} catch (JAXBException ex) {
getLogger(FlowProcessor.class.getName()).log(Level.SEVERE,
"Fail to write configuration down to config file[{0}] due to error : \n{1}",
new Object[]{this.xmlPath, ex});
throw ex;
}
}
FlowProcessor.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:yummy-xml-UI
作者:
评论列表
文章目录