jaxb2

JAXB empty node in bindings

半腔热情 提交于 2020-01-14 10:40:52
问题 JAXB can't parse the bindings for this example: <xs:element name="classA" type="classA" substitutionGroup="classSubA"/> <xs:complexType name="complexClassA" mixed="true"> <xs:attribute name="attA"> <xs:annotation> <xs:appinfo> <moProperty value="classA:attA"/> <label value="Attribute A" default="true"/> <externAccess value="readWrite"/> <description value="NO COMMENTS"/> </xs:appinfo> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="off"/> <xs

Convert nil=“true” to null during unmarshal operation

ⅰ亾dé卋堺 提交于 2020-01-13 19:08:08
问题 I am receiving XML from a server whose schema specifies nearly every element as: <xs:element name="myStringElementName" type="xs:string" nillable="true" minOccurs="0"/> <xs:element name="myIntElementName" type="xs:int" nillable="true" minOccurs="0"/> I'm trying to find a clean way to convert every element that I receive that is marked as xsi:nil="true" to a null when it is unmarshalled into a JAXB object. So something like this: <myIntElementName xsi:nil="true" /> Should result in my JAXB

Convert nil=“true” to null during unmarshal operation

你。 提交于 2020-01-13 19:06:32
问题 I am receiving XML from a server whose schema specifies nearly every element as: <xs:element name="myStringElementName" type="xs:string" nillable="true" minOccurs="0"/> <xs:element name="myIntElementName" type="xs:int" nillable="true" minOccurs="0"/> I'm trying to find a clean way to convert every element that I receive that is marked as xsi:nil="true" to a null when it is unmarshalled into a JAXB object. So something like this: <myIntElementName xsi:nil="true" /> Should result in my JAXB

Unmarshalling Error: unexpected element (uri:url, local:“objectname”). Expected elements are <{}objectname>

筅森魡賤 提交于 2020-01-13 09:25:09
问题 I'm using jaxb2-marshaller to generate classes to communicate with a webservice. Java-classes are generated with use of some wsdl files. Everything is okay now, but when I'm trying to use some of the generated classes, i got this unmarshalling error, altough I use the generated ObjectFactory classes. Some of the stack: org.springframework.ws.soap.client.SoapFaultClientException: Unmarshalling Error: unexpected element (uri:"http://xxxxxxxxx", local:"customer"). Expected elements are <{

Add schema location to JAXB unmarshaller

ぃ、小莉子 提交于 2020-01-06 16:21:47
问题 I am facing the below error when JABX unmarshaller tries to unmarshall the xml Exception in thread "main" javax.xml.bind.UnmarshalException - with linked exception: [org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 456; The prefix "xsi" for attribute "xsi:nil" associated with an element type "customerProductStatus" is not bound.] When I looked at the xml being returned from the server , it is the below : <customerProductStatus xsi:nil = "true"></customerProductStatus> I don't see

how to map same value to two different fields in jaxb while marshalling and unmarshalling

烂漫一生 提交于 2020-01-06 04:10:16
问题 I have a xml tag Hello for which there is a field like below in my java class HelloWorld{ @XmlElement private String name; } While unmarshalling this successfully assigns Hello value to name variable.Now I want to create a new xml from THIS java object(HelloWorld) for which I am doing the marshalling but in this case I want a xml tag as instead of in my xml. How can I acheive this in Jaxb? Both Xml are not in my control so I cannot change the tag name EDIT: Incoming XMl - helloworld.xml

Generating jaxb classes with naming conflicts

我只是一个虾纸丫 提交于 2020-01-05 08:30:36
问题 I have created a new JAXB project and imported an xsd which I am trying to generate JAXB classes off of. When I select "Generate->JAXB Classes" I get a number of similar errors all which relate to naming conflicts: A class/interface with the same name "generated.Document" is already in use. Use a class customization to resolve this conflict. The above error is thrown from the following piece of the .xsd file <xs:complexType name="Document"> <xs:sequence> <xs:element ref="Document"/> </xs

java jaxb simple parsing is requiring @XmlAccessorType(XmlAccessType.FIELD) annotation

断了今生、忘了曾经 提交于 2020-01-03 21:02:57
问题 I am trying to parse an xml to java objects, I've read and implemented the following tutorial: http://www.vogella.com/articles/JAXB/article.html (works perfectly) But when I create my own clases (similar to those in the tutorial) I get: Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Class has two properties of the same name "clienteList" Unless I use @XmlAccessorType(XmlAccessType.FIELD) on class Clientes

java jaxb simple parsing is requiring @XmlAccessorType(XmlAccessType.FIELD) annotation

荒凉一梦 提交于 2020-01-03 21:02:52
问题 I am trying to parse an xml to java objects, I've read and implemented the following tutorial: http://www.vogella.com/articles/JAXB/article.html (works perfectly) But when I create my own clases (similar to those in the tutorial) I get: Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Class has two properties of the same name "clienteList" Unless I use @XmlAccessorType(XmlAccessType.FIELD) on class Clientes

Is there a JAXB Plugin which generates Builders?

混江龙づ霸主 提交于 2019-12-30 06:08:21
问题 Are you aware of any good JAXB Plugin which generated Builder pattern classes for the generated JAXB classes? Composing domain using JAXB generated classes is really nasty. I saw a plugin someone wrote back in 2010 but it doesn't use the newest maven plugin jaxb2-maven-plugin, and it also requires you to specify bindings for each schema type which is not robust. 回答1: Yes, there is now a plugin to generate fluent builders for JAXB-generated classes. There is a github project on https://github