Questions tagged [xmladapter]

55 questions
1
vote
3 answers

JAXB mappable XML elements

In the root.class from my xi-schema, the element item and ohter objects are part of an itemList: @XmlElementRef(name = "item", namespace = "xi", type = JAXBElement.class, required = false) //... protected List itemList; I've in the…
chrk
  • 41
  • 5
1
vote
2 answers

XMLAdapter: Configurable Date Format

I'm unmarshaling XML data using JAXB (and a little Saxon for XSLTs). In my XML document I have a date string value. I did some research and experimented with XMLAdapter and @XMLJavaTypeAdapter. I found a useful Q&A on StackOverflow here: jaxb…
Random Human
  • 946
  • 1
  • 14
  • 31
1
vote
0 answers

(Jersey + Jackson) XmlAdapter

I have a class Foo which has a variable Map bar. But as a requirement, I need to be able to represent it as an Object. So I use a GenericXmlAdapter which in turn does an instanceof check and invokes a Map adapter. A MapAdapter converts the Map into…
Vikram Bodicherla
  • 7,133
  • 4
  • 28
  • 34
0
votes
0 answers

Using JAXB with @XmlValue, @XmlElementRef and @XmlAdapter and keeping the order as received

Disclaimer: This is just a very simple example. My scenario is much more complex than this. Scenario: My input XML: ... Hello John. Your policy number has arrived. Please…
Adriano
  • 1
  • 2
0
votes
0 answers

XMLAdapter - How is it possible to create a XMLAdapter for a List object using package-info

I have an Element that's being used many times. This element is a List of a specific class. I created an Adapter for each item of this list and, considering it's inside of many nodes, I'd like to put the adapter at package-info level instead of…
Adriano
  • 1
  • 2
0
votes
1 answer

XMLAdapter - Is it possible to call de default marshal method inside the adapter?

I have a system when I need to convert one XML to another. Todo so, I have a model that I'm unmarshalling into, doing some necessary changes and then marshalling to the final XML. One class has one attribute (description) that's inside only at the…
Adriano
  • 1
  • 2
0
votes
1 answer

Is there a way to pass Class as a Parameter to the JAXB XMLAdapter or access Getter method from another class

I am trying to create an XMLAdapter class for one of my objects. I need to access Getters from another class so that some of the objects can be populated from that class's Getters` but I am unable to do so. Basically, I would like to access my Child…
BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
0
votes
1 answer

JAXB XMLAdapter: Is there a way to convert this method into JAXB XmlAdapter

I have a JSON file that I am trying to convert into XML using the JAXB annotation approach. Everything is working fine now and I able to convert the JSON to XML. Now I am trying to refactor the code a little bit so that my class would look clean.…
BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
0
votes
0 answers

How to convert json datatime object to string in java 8

I have an application, when I run it on liberty server the localdatetime works fine as a string e.g "2017-05-27T22:14:30" but when I run the same application on websphere server the localdatetime displays as object, e.g as below: "wrongDate" : { …
Pleasure
  • 279
  • 2
  • 6
  • 19
0
votes
0 answers

JAXB MOXy - XmlJavaTypeAdapter Annotation not read on XmlRootElement object

I have a simple class which must be marshalled/unmarshalled with a specific XmlAdapter: package jaxb; import java.io.Serializable; import java.io.StringReader; import java.io.StringWriter; import java.util.Arrays; import…
Lazarus
  • 147
  • 13
0
votes
1 answer

Compile-Time and Load-Time Weaving and Autowired on XMLAdapter not working

I have an XML-based database and I have defined a User model with a list of references to Role (another model). I have attached an XMLAdapter to roles property to auto-populate roles. For that, I've @autowired the RoleRepository in this…
jcpaiva
  • 422
  • 1
  • 6
  • 14
0
votes
0 answers

jaxb-runtime-2.3.0 java.lang.NumberFormatException: Not a n│ umber: undefined

While I've seen other very similar questions, I haven't found one that give me a proper solution. I have XML coming in like this
0
votes
0 answers

Using JAXB, how can I unmarshal into a java object with multiple XmlJavaTypeAdapter references?

I'm trying to use JAXB to unmarshal a data (Polygon) with two @XmlJavaTypeAdapter annotations (Subscriber, Tag) to and from an XML file. Each object has it's own XML file, and the objects are related thus: Each Subscriber may hold multiple Polygons…
Chris
  • 409
  • 3
  • 17
0
votes
0 answers

XmlAdapter depending on previously parsed data

I need to read/write an object from/to xml file. The object contains an array of elements. Let's say that Element class looks as follows: public class Element() { private BigInteger v; private BigInteger p; public Element(BigInteger v,…
Marek Klein
  • 1,410
  • 12
  • 20
0
votes
1 answer

Converting Jaxb attribute value to Upper Case during UnMarshalling

I want to convert uid attribute's value in MyJaxbModel class to uppercase during UnMarshalling. I did write UpperCaseAdapter that does the work for me. However with this approach, application performance is deteriorated to unacceptable level (as…