XML -> Java -> XML the xsi:schemaLocation is lost when using JAXB
When JAXB is used for round tripping XML -> Java -> XML the xsi:schemaLocation is lost in the XML file that is obtained. This is because this attribute is not a part of the XML schema the JAXB xjc compiler uses to generate the java classes.
Can you please help me on how to achieve this?
Below is the schema file, schema.xsd:
<?xml version='1.0' encoding='UTF-8'?>
Below is my xml file: conf.xml
<?xml version="1.0" encoding="UTF-8"?>
If you see in the above xml file, 'schemaLocation' attribute is there. But when I convert the xds to java and then to xml, this 'schemaLocation' attribute is not there in the xml file.
Inorder to retain the 'schemaLocation' in my xml file, Where I need to add the same in the xsd file before converting it to java using xjc. Or is there any other way so that I can retain the same.