jaxb

How to map xml fields without parent tag to java list?

牧云@^-^@ 提交于 2021-02-11 06:15:41
问题 I have following xml response from web service which need to map to java class. <api1Response> <timeStamp>06/24/2016 07:45:10</timeStamp> <ippProjectName>xyz</ippProjectName> <project> <projectId>1</projectId> <projectName>ABC</projectName> <dataDate>06/06/2016</dataDate> </project> <project> <projectId>2</projectId> <projectName>PQR</projectName> <dataDate>06/06/2016</dataDate> </project> </api1Response> I have mapping class like class api1Response{ String timeStamp; String ippProjectName; /

How to map xml fields without parent tag to java list?

白昼怎懂夜的黑 提交于 2021-02-11 06:14:47
问题 I have following xml response from web service which need to map to java class. <api1Response> <timeStamp>06/24/2016 07:45:10</timeStamp> <ippProjectName>xyz</ippProjectName> <project> <projectId>1</projectId> <projectName>ABC</projectName> <dataDate>06/06/2016</dataDate> </project> <project> <projectId>2</projectId> <projectName>PQR</projectName> <dataDate>06/06/2016</dataDate> </project> </api1Response> I have mapping class like class api1Response{ String timeStamp; String ippProjectName; /

Specification and correct use of (boolean) URI matrix parameters (and making them optional when using CXF/JAXB)?

℡╲_俬逩灬. 提交于 2021-02-09 11:52:09
问题 I was wondering if the "proper" use of URI/URL matrix parameters was ever defined in a specification, such as an RFC or a W3 recommendation? In particular, I just joined a project where we use matrix parameters and a Java framework to implement a REST service. One of the matrix parameters we have for our REST service is a boolean one, much like ;sortByDate=true What bugged me about this one is that the Java framework we use apparently insists that boolean parameters are always passed in (i.e.

Using JAXB to create XML from MAP

别说谁变了你拦得住时间么 提交于 2021-02-08 08:49:16
问题 I want to create XML from Java.util.Map I am putting values in that map and trying to create XML which root element will be configurable and child elements will be created from that map. Map mp = new HashMap(); mp.put("key","shaon"): mp.put("newKey","newValue"); And the XML will be like: <shaonsXML> <key>shaon</key> <newKey> newValue </newKey> </shaonsXML> I have seen example which uses JAXB, but those example does not create XML tag as I am trying to generate. Can anyone give me some link or

Which JAXB version was used in Java 8?

天大地大妈咪最大 提交于 2021-02-08 06:52:49
问题 JAXB (Java Architecture for XML Binding) has been publised as Maven artifacts although it was bundled with JREs until Java 8 (and Java 9/10 with an option). My question here is: Which JAXB version on Maven Central corresponds to Java 8's bundled version? (And, also for Java 9/10's under a feature option?) I'm seeing in https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api : 2.2.* (~ 2.2.12) 2.3.0 2.3.1 2.4.0-* (under development) (3.0.0 to be jakarta.xml.* ) 回答1: As far as Java 8: $ $(

Which JAXB version was used in Java 8?

岁酱吖の 提交于 2021-02-08 06:51:21
问题 JAXB (Java Architecture for XML Binding) has been publised as Maven artifacts although it was bundled with JREs until Java 8 (and Java 9/10 with an option). My question here is: Which JAXB version on Maven Central corresponds to Java 8's bundled version? (And, also for Java 9/10's under a feature option?) I'm seeing in https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api : 2.2.* (~ 2.2.12) 2.3.0 2.3.1 2.4.0-* (under development) (3.0.0 to be jakarta.xml.* ) 回答1: As far as Java 8: $ $(

Maven + Resteasy JAXB could not find writer for content-type application/xml

喜欢而已 提交于 2021-02-08 05:06:53
问题 I want to create a .jar that will be used in other projects which amongst others, makes use of the ReastEasy libraries (jaxb, jaxrs, jaxrs-clients etc). Although I am including all libraries, and everything works well in maven based projects, apparently some libraries are not included in the .jar and I am getting the following exception in simple Java SE projects where the .jar is just included in the lib folder: RuntimeException: could not find writer for content-type application/xml type

Maven + Resteasy JAXB could not find writer for content-type application/xml

ぐ巨炮叔叔 提交于 2021-02-08 05:05:03
问题 I want to create a .jar that will be used in other projects which amongst others, makes use of the ReastEasy libraries (jaxb, jaxrs, jaxrs-clients etc). Although I am including all libraries, and everything works well in maven based projects, apparently some libraries are not included in the .jar and I am getting the following exception in simple Java SE projects where the .jar is just included in the lib folder: RuntimeException: could not find writer for content-type application/xml type

Using JAXB with Character

こ雲淡風輕ζ 提交于 2021-02-07 22:55:52
问题 I have an @XMLElement that is of type Character but when it get marshalled it appears to get put into a binary string so for example... 'n' becomes 110 'e' becomes 101 Short of converting them to Strings is there a way I can output the text char instead of the representation? 回答1: You could write an XmlAdapter . An XmlAdapter allows you to convert one type of object to another for the purposes of marshalling/unmarshalling. XmlAdapter (CharacterAdapter) import javax.xml.bind.annotation

XJC does not generate enum inside xs:union

核能气质少年 提交于 2021-02-07 13:15:42
问题 I have several XSD files containing structures like the following: <xs:complexType name="SomeThing" abstract="false"> <xs:sequence> <xs:element name="id" type="schema2:SomeIdTypeClass" minOccurs="1" maxOccurs="1"/> <xs:element name="myType" type="schema1:MyType" minOccurs="1" maxOccurs="1"/> </xs:sequence> </xs:complexType> <xs:simpleType name="MyType"> <xs:union> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="APPLE"/> <xs:enumeration value="ORANGE"/> <xs:enumeration