Questions tagged [xmladapter]

55 questions
18
votes
1 answer

JAXB XMLAdapter method does not throws Exception

I am using JAXB XMLadapter to marshal and unmarshal Boolean values. The application's XML file will be accessed by C# application also. We have to validate this XML file and this is done using XSD. C# application writes "True" value for Boolean…
jatin mistry
  • 205
  • 3
  • 7
8
votes
1 answer

JAXB @XmlAdapter: Map -> List adapter? (marshall only)

I have a Map. The first idea everyone has is to convert it to a List> (Pair being a custom class). I've tried a @XmlAdapter like this: public class MapPropertiesAdapter extends XmlAdapter,…
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
8
votes
3 answers

Confused as how to use JAXB XML Adapter for my requirement

I am Using JAXB for unmarshalling process , for which the request comes from the UI to our service class . The below is the format of XML request .
Pawan
  • 31,545
  • 102
  • 256
  • 434
5
votes
1 answer

using custom jaxb bindings to get xs:datetime to Joda time but getting XMLGregorianCalender

Java 1.7 Spring 3.1.1 with Spring-WS 2.1.1 Joda Hibernate 3.6 MySQL 5.0.57 Maven 3 Tomcat 7 Eclipse 3.7 Have got the web service deployed and the web client deployed and the web service and web client talking to each other. But just like in a…
user1201168
  • 415
  • 6
  • 19
5
votes
0 answers

Using a JAXB XmlAdapter to adapt an entire list without a wrapper element

I'm trying to use an XmlAdapter to unmarshal XML into a custom collection type (that intentionally does not implement the Collection interface due to a conflicting restriction imposed by another use of the class, which unfortunately fails if the…
Corey G
  • 7,754
  • 1
  • 28
  • 28
4
votes
1 answer

JAXB marshal an ArrayList created by XmlAdapter

I want to adapt the XML representation of a HashMap field using XmlAdapter. I use an ArrayList to do that. However, when marshalling the ArrayList is not marshalled at all. Why is that? The code @XmlRootElement public class Foo { private…
hansi
  • 2,278
  • 6
  • 34
  • 42
3
votes
1 answer

JAXB marshall without parent element

There are two JavaBean A and B. and 2 String C and D. There structure is A --B ----C ----D I can marshall Object A to Xml ccc ddd And In some cases, I'd like to marshall A to XML like this
3
votes
1 answer

jaxb, can I use @XmlJavaTypeAdapter with @XmlElements?

Given the following annotations @XmlElements({ @XmlElement(name = "first", type = First.class), @XmlElement(name = "second", type = Second.class), @XmlElement(name = "third", type = Third.class), @XmlElement(name = "fourth", type =…
2
votes
0 answers

How to use a custom marshaller in spring WS

I created a SOAP Webservice using spring-ws. Here is my config Class : @EnableWs @Configuration public class EmutationSOAPConfig extends WsConfigurerAdapter { @Autowired LoggingInterceptor loggingInterceptor; @Bean public…
abderrahim_05
  • 445
  • 1
  • 4
  • 21
2
votes
1 answer

JAXB override @XmlElement type of list

There's a simple class Bean1 with a sublist of type BeanChild1. @XmlRootElement(name="bean") @XmlAccessorType(XmlAccessType.PROPERTY) public static class Bean1 { public Bean1() { super(); } private List childList = new…
bvdb
  • 22,839
  • 10
  • 110
  • 123
2
votes
2 answers

Is Reflection needed to apply the correct generic adapter to my object dynamically

I am currently working on a serialization routine which uses a library of generically typed adapters. If the object being serialized is an instance of one of the specific adapters I have, then I need to call that adapter on the object prior to…
Dan
  • 147
  • 14
2
votes
1 answer

How to let JAXB exclude empty node?

I'm using JAXB to serialize objects to XML. Now I realize that it will exclude natural null values from response but will not exclude null values from customized adapters. Below is my code. package com.model; import…
Edmond
  • 614
  • 2
  • 11
  • 26
2
votes
1 answer

Issue with JAXB XMLAdapter marshalling

I have a requirement to generate an XML file with below format using JAXB2, It has both Fixed and Variable xml content. What is the Constraint? The content of Variable XML Part should be one of the 5 different XML schema( planned to have JAXB2.0…
omega
  • 592
  • 2
  • 5
  • 21
2
votes
1 answer

How can JAXB XmlAdapter be used to marshall lists?

Instances of this class are part of a large object graph and are not at the root of the object graph: public class Day { public Day(LocalDate date, List times) { this.date = date; this.times = times; } …
Steve
  • 8,066
  • 11
  • 70
  • 112
1
vote
0 answers

XmlAdapter is ignored by Spring boot 3

Below is a test class. I am using spring boot 3 with Java 17 and JAXB. Controller is Rest controller. O/P from the endpoint is expected to be amount_currencyCode. However, the adapter is ignored by spring and unwanted xml is…
Nitin
  • 11
  • 1
1
2 3 4