I have my User class in java. When I want to unmarshal it, I get xml with <UserIn> root element, and when I want to marshal it I should do <UserOut> to be XML root element. If I provide @XmlRootElement("UserIn") it is not dynamic and it is always UserIn root. Is there any way to do dynamic root element on class? thanks.
JAXB dynamic XML root class name
587 Views Asked by Matija Župančić At
1
There are 1 best solutions below
Related Questions in JAXB
- Why doesn't wrapping a List/Map in a JAXBElement work?
- JAXB How to append and XML String into a XML element?
- JAXB - why can i only marshal to a stream/file?
- I am new to JAXB. How can I merge two different xmls with different namespaces into one xml with a root element and unmarshal it?
- Why fasterxml lost the "xsi:type" attribute with JaxbAnnotationModule but JAXB Marshaller is fine
- Can I unmarshal a single xml property to a multi element array?
- How to stop XML Tag Attributes from sorting in Ascending Order after modifying the XML file using Java?
- Efficiently unmarshaling a part of a large xml file with JAXB and XMLStreamReader
- exception unmarshalling xml file using jaxb
- OSGI compatible artifact for jaxb2-basics?
- Unable to locate binding.xml for Maven JAXB plugin (jaxb2-maven-plugin)
- XMLGregorianCalendar not displayed in the right format when marshalled
- Convert date type to string in jaxb using bindings
- JAXB on-demand unmarshalling
- JAXB - how to create xml from object with <set varname = "String" value = name "String2"> elements
Related Questions in MARSHALLING
- Why doesn't wrapping a List/Map in a JAXBElement work?
- Marshalling C# from DLL to WPF form
- Call class member of c++ DLL from c#
- Reading binary file into struct
- Problems when P/Invoking CertCreateSelfSignCertificate
- XMLGregorianCalendar not displayed in the right format when marshalled
- Get object reference name in Java for constructing XML
- Byte array Marshalling
- .NET Interop: How to get returned string (not null terminated) from unmanaged DLL in C#
- reconstruct python method with kwargs with marshal and types?
- Marshall map to XML in Go
- Is dllexport needed in the source C dll to be able to be used in c# with [DllImport]?
- Marshal struct in struct from c# to c++
- How to correctly marshal .NET Strings to std::wstrings for native code?
- Calling C DLL function from C# - parameter struct too large or complex to marshal
Related Questions in UNMARSHALLING
- I am new to JAXB. How can I merge two different xmls with different namespaces into one xml with a root element and unmarshal it?
- reconstruct python method with kwargs with marshal and types?
- JAXB UnmarshalException - Filename containing #
- How to make CXF generated code to unmarshal into JAX-B and ignore unmapped fields?
- Swing JList - read and write XML from file
- Unmashalling with StAX - it skips elements if there's no whitespace between them
- Go JSON parsing
- Jaxb unmarshal works on debug but not in runtime
- How to unmarshal dynamic json objects with Golang
- Jaxb String from XML
- Jaxb Error while Creating Unmarshller
- Jaxb Unmarshall with an unknown @XmlRootElement
- Global memory access
- Go json.Unmarshal returns false struct
- Golang marshal dynamic xml element name
Related Questions in XMLROOT
- How do I add a class inside the XML root, in an existing XML file?
- XmlElement shows up as lowercase in SOAP
- XmlSerializer Deserializing Array/List of Multiple Objects at Root
- Replace ArrayOf* Root Element using API Controller in Visual Studio C#
- How to add a root to an XML file?
- One POJO but the different XmlRootElement name
- XmlRoot attribute serialization to a file
- Rename serializable class
- Get attribute names and values from ElementTree
- JAXB dynamic XML root class name
- xmlconvert string to date
- Serializing class decorated with XmlRoot, error when used in List
- XmlRoot() for Xml Serilization does not work
- How to consume XML with more than one possible root element in Spring REST client
- How to print pretty JSON using docx4j into a word document?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You could create two classes that extend your User class, and then use the specific child class based on if you are marshalling on unmarshalling.
For example, for a class User:
You can have UserIn:
and UserOut:
Provide the appropriate class where you need, and you will get it working with the input or output you wish.