spring mvc - How do I add attributes to a root element when the class is generated by JAXB? -


I'm developing a REST API which uses Spring MVC Anseepeedeepi () object which Akssdis I consumption and production I am (using JAASB) is generated when everything comes to me in the requests, but I want to add additional properties to the outward requests on the original element.

Right now, my outward response looks like this:

   

And it should look like this:

  & lt ;? XML version = "1.0"? & Gt; & Lt; Transport: Send xmlns: transport = "http://www.ncpdp.org/schema/transport" xmlns: datatypes = "http://www.ncpdp.org/schema/datatypes" xmlns: script = "http: // www.ncpdp.org/schema/script "xmlns: structures =" http://www.ncpdp.org/schema/structures "xmlns: find structures =" http://www.ncpdp.org/schema/ find structures " xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" StructuresVersion = "v2014041" ECLVersion = "v2014041" DatatypesVersion = "v2014041" PA-StructuresVersion = "v2014041" TransactionVersion = "V2014041" Transport Virsian = "V2014041" transaction diamond = "script" & gt; & Lt; Transportation: Header & gt; ... & lt; / Transport: Header & gt; & Lt; Transport: body & gt; & Lt; Transport: Status & gt; & Lt; Transport: Code & gt; 010 & lt; / Transport: Code & gt; & Lt; / Transport: Status & gt; & Lt; / Transport: body & gt; & Lt; / Transport: Message & gt; The  

I do not believe that I need all the namespaces defined (because they are not), but what I need Strccharsvirsn and all other characteristics to include these properties My binding for. Is there a way to modify XJB? Or do I copy the code generated in my source tree and add annotation to it?

Thank you,

Matt

Since these attributes If your XML schemas are declared, then you should be getting the appropriate attributes in your schema derived code.

It does not really matter if it's out of a principle or some fundamentals Check again Please generated code, getStructuresVersion () something like so you anything There is no need to do

For the namespace, you will declare them automatically, when you will martial. But you can first declare them as ns0 , ns1 etc. Which is not very good in terms of readability. Please see the following questions.

/ Html>

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Algorithm negotiation fail SSH in Jenkins -

java - Messages from .properties file do not display UTF-8 characters -