Just create a package-info.java file for your package in which you have your POJO:
@javax.xml.bind.annotation.XmlSchema(namespace = "http://myNameSpace", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package my.package;
The ns2 will be gone when you perform the usual Entity.xml(...)
Donnerstag, 19. April 2018
Mittwoch, 18. April 2018
Generate JAXB Java Classes from XSD File
This is a fine one: if you only do have XML and nothing else, you can generate an XSD from the XML (here) and use the XSD to generate your Java POJOS.
I am currently forced to use windows, so I will use this example.
Download jaxb-ri-2.3.0 (Version may differ for you, what ever is the newest version).
Open CMD window and change to the directory jaxb-ri-2.3.0\jaxb-ri\bin
Copy your XSD into the folder and type:
xjc.bat <yourfile.xsd> -d <yourDirectory>
And your POJOs will be generated, ready to use.
I am currently forced to use windows, so I will use this example.
Download jaxb-ri-2.3.0 (Version may differ for you, what ever is the newest version).
Open CMD window and change to the directory jaxb-ri-2.3.0\jaxb-ri\bin
Copy your XSD into the folder and type:
xjc.bat <yourfile.xsd> -d <yourDirectory>
And your POJOs will be generated, ready to use.
Abonnieren
Posts (Atom)
NEW BLOG! http://cleancode.consulting/
Dear Reader, This Blog is closed and remains as an archive. Please find our new Blog at http://cleancode.consulting/
-
Resolve a Merge Conflict in GIT with IntelliJ Let us assume you are using Bitbucket or a similar tool to administrate and host your GI...
-
Just create a package-info.java file for your package in which you have your POJO: @javax.xml.bind.annotation.XmlSchema(namespace = ...