spring-oxm


Ignoring DTDs when unmarshalling with EclipseLink MOXy

半世苍凉 提交于 2020-02-24 03:35:52
问题 When trying to unmarshall some XML into a POJO using EclipseLink MOXy I'm getting a FileNotFoundException where it's looking for the document's DTD as a relative path. Exception in thread "main" org.springframework.oxm.UnmarshallingFailureException: JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException - with linked exception: [java.io.FileNotFoundException: C:\Users\deejay\Documents\workspace-sts-3.0.0.RELEASE\moxy-test\ieee_idams_exchange.dtd (The system cannot

JAXB: Is there a way to unmarshal only specific paths in an XML?

依然范特西╮ 提交于 2020-01-06 00:55:30
问题 I have an XSD which defines a hierarchy of several complex types (each one being a child of the other). Ex: <xs:schema version="1.3" targetNamespace="https://www.domain.com/schema/reports/export/1.0" xmlns:tns="https://www.domain.com/schema/reports/export/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="detailedreport"> <xs:complexType> <xs:sequence> <xs:element name="severity" minOccurs="6" maxOccurs="6" type="tns:SeverityType" /> </xs

JAXB: Is there a way to unmarshal only specific paths in an XML?

邮差的信 提交于 2020-01-06 00:55:09
问题 I have an XSD which defines a hierarchy of several complex types (each one being a child of the other). Ex: <xs:schema version="1.3" targetNamespace="https://www.domain.com/schema/reports/export/1.0" xmlns:tns="https://www.domain.com/schema/reports/export/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="detailedreport"> <xs:complexType> <xs:sequence> <xs:element name="severity" minOccurs="6" maxOccurs="6" type="tns:SeverityType" /> </xs

Spring MVC with JAXB, List response based on a Generic class

十年热恋 提交于 2019-12-11 04:06:52
问题 I am working with Spring 4, together with Spring MVC. I have the following POJO class @XmlRootElement(name="person") @XmlType(propOrder = {"id",...}) public class Person implements Serializable { … @Id @XmlElement public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } … } If I want return a list of Person through Spring MVC in XML format, I have the following handler @RequestMapping(value="/getxmlpersons/generic", method=RequestMethod.GET, produces=MediaType

Proper way to use Spring JAXB Marshaller with Java 9 without defining additional modules

跟風遠走 提交于 2019-12-09 01:44:27
问题 To illustrate my issue, I created a small spring boot sample application. The purpose of the application is to create a Jaxb2Marshaller bean. @SpringBootApplication public class App implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(App.class, args); } @Bean public Jaxb2Marshaller jaxb2Marshaller() { Jaxb2Marshaller bean = new Jaxb2Marshaller(); bean.setContextPath("ch.sahits.game.helloworld"); return bean; } @Override public void run(String... args)

Proper way to use Spring JAXB Marshaller with Java 9 without defining additional modules

回眸只為那壹抹淺笑 提交于 2019-12-01 00:19:12
To illustrate my issue, I created a small spring boot sample application. The purpose of the application is to create a Jaxb2Marshaller bean. @SpringBootApplication public class App implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(App.class, args); } @Bean public Jaxb2Marshaller jaxb2Marshaller() { Jaxb2Marshaller bean = new Jaxb2Marshaller(); bean.setContextPath("ch.sahits.game.helloworld"); return bean; } @Override public void run(String... args) throws Exception { System.out.println("Started up"); } } This code fails to start up with the

How to use spring to marshal and unmarshal xml?

亡梦爱人 提交于 2019-11-27 10:59:21
问题 I have a spring boot project. I have a few xsds in my project. I have generated the classes using maven-jaxb2-plugin. I have used this tutorial to get a sample spring boot application running. import org.kaushik.xsds.XOBJECT; @SpringBootApplication public class JaxbExample2Application { public static void main(String[] args) { //SpringApplication.run(JaxbExample2Application.class, args); XOBJECT xObject = new XOBJECT('a',1,2); try { JAXBContext jc = JAXBContext.newInstance(User.class);

工具导航Map