XML data binding refers to a means of representing information in an XML document as an object in computer memory. This allows applications to access the data in the XML from the object rather than using the DOM or SAX to retrieve the data from a direct representation of the XML itself.
Questions tagged [xml-binding]
92 questions
3
votes
5 answers
Is it justified to use Reflection in this use case to workaround design issue that i am not allowed to fix?
Would the following use case be considered as justified for Reflection?
There are bunch of classes generated from XSDs (hundreds currently on project) which represent various Responses.
All of these Responses include common response data…

John
- 5,189
- 2
- 38
- 62
3
votes
2 answers
Jaxb Mapping Bidirectional Relationship
I have a List .
When i am marshalling this list, I am getting an error :
javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.internal.SAXException2: A cycle is detected in the object graph. This will…

saurabh
- 257
- 1
- 3
- 12
3
votes
2 answers
xjc type definition name resolution error
I am running into troubles when wanting to compile my XSDs (which I am not the author of) with XJC.
Specifically, I get the error (there are actually more like these):
[ERROR] src-resolve: Cannot resolve the name "ifopt:CountryRefStructure" to a(n)…

Andreas
- 3,929
- 2
- 25
- 22
2
votes
1 answer
Making data model classes serializable
I am using JiBX for XML-Java data binding. The current configuration generates classes pretty well but I want these generated classes to implement java.io.Serializable.
Here is maven plugin configuration to generate java classes from given…

Amit Patel
- 15,609
- 18
- 68
- 106
2
votes
2 answers
How to map REST output to a Dto in Spring Boot using @XmlElement annotation , so that i can get the xml output in desired format?
I have two classes/tables---
Customer and Address having a bi-directional one-to-one relationship.
I getting the details from these two tables and exposing them using a rest controller and i am getting the following output.
But instead of
- …

Arpan Banerjee
- 826
- 12
- 25
2
votes
1 answer
@XmlRootElement vs @JacksonXmlRootElement
What is exact difference between @XmlRootElement @JacksonXmlRootElement?
I know @XmlRootElement is generic, But when I check package structure both are different.
So there must be some advantage and disadvantage while using this.

Pramod
- 69
- 1
- 10
2
votes
0 answers
JAXB - Unmarshal and marshall objects with processing instructions
We want to use JAXB to create Java objects from XML files, manipulate them and save them back into XML files. This is not a problem in principle. However, the source XML files contain processing instructions, which are not stored back into the…

Ben
- 290
- 2
- 17
2
votes
2 answers
how to derive xml element name from an attribute value of a class using annotations?
I have
properties that have ids and values and a name. Can I represent all those with a single class using XmlElement/XmlArray C# annotations? I would like to derive the xml element name from the class attribute name;
my class would look…

Michail Michailidis
- 11,792
- 6
- 63
- 106
2
votes
1 answer
get all xml prefix to namespace mappings using javax xml binding annotations
Is it possible to bind xml prefix→namespace mapping to a map using javax.xml.bind.* annotations?
Something like:
class FooPOJO {
...
@Namespacebindingannotation
Map prefixToNamespaceMap;
...
}
And in the xml

eladidan
- 2,634
- 2
- 26
- 39
2
votes
2 answers
JAXB xml ordering or Sequence or property ordering
i want to marshal my object in a ordered xml.
My jaxb class is given below:-
i have used Xmlordering but it doesn't work to order my xml.
package mypackage;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import…

NameNotFoundException
- 876
- 14
- 31
2
votes
1 answer
How to write an xml annotation in Java for a self-contained tag with attributes
I'm using the annotations from the package javax.xml.bind.annotation to construct SKOS XML files. I have some trouble about the best way to realize lines like the following (please, observe that the rdf prefix has been set in the package-info.java…

mat_boy
- 12,998
- 22
- 72
- 116
2
votes
1 answer
Java xml binding with JAXB: Marshaling content from a field into the root element
i have a class like this:
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlRootElement(name="someClass")
public class SomeClass implements Serializable {
[...]
@XmlElement(name="field")
public String getSomeField() {
return field;
…

Clara.D
- 23
- 2
2
votes
1 answer
XJC restriction convert Double to String
i read XML by generated javax.xml.bind-Annotated classes from XSD.
So my class is generated to:
public Double getBar(){....}
Ok, to ensure a…

Grim
- 1,938
- 10
- 56
- 123
2
votes
0 answers
Is there a maven plugin to do wsdl to java with xstream mappings?
At present i know that there is a plugin called cxf-codegen plugin which converts wsdl to java with jaxb bindings .At present I just give the wsdl file and xsd file , the maven cxf-codegen plugin takes care of conversion fron wsdl to java with…

Harish Kayarohanam
- 3,886
- 4
- 31
- 55
2
votes
0 answers
JAXB XJC - Bind XML schema version into class name
We have two XML schemas with same element name but different namespaces. When I use xjc, the compiler is assigning elements to the same classpath and element. As shown below, the root issue is in the handling of the XML Schema namespace with leading…

Bevo
- 530
- 5
- 17