Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Is there a marshaling exception when using jaxb?


Asked by Kendrick Cantrell on Dec 06, 2021 FAQ



I have java code and i'm trying to parse it and store it as XML file on my PC using JAXB but i have a marshaling exception: The JAXB code i'm using :
Furthermore,
As part of this process, JAXB provides methods for unmarshalling (reading) XML instance documents into Java content, and then marshalling (writing) Java content back into XML instance documents. JAXB also provides a way to generate XML schemas from Java objects.
Accordingly, To marshal a JAXB object into an XML string, you will need to create a StringResult and pass that to the marshal () method. Java 6 and later have the standard JAXB interfaces and factories for processing xml available in the java.xml.bind package. You can find more info about JAXB on the JAXB project web site.
In addition,
The JAXB Marshaller interface is responsible for governing the process of serializing Java content trees i.e. Java objects to XML data. This marshalling to XML can be done to variety of output targets. Generally, to create marshaller you can reuse this code.
Additionally,
Marshaller jaxbMarshaller = jaxbContext.createMarshaller (); jaxbMarshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, true); The XML file will be generated base don the RequestClass. All the other files would have to add the @XmlSeeAlso ( {RequestClass.class}) to avoid this exception.