Issue: No annotation provided for adding XSI location to root. Another stackoverflow question detailed the same problem but in C#. I'm not quite sure how to covert that over to JAVA. I need to update XML in a flat file and thought of just using string manipulation to add the XSI locations but I was hoping there might be a cleaner approach.
Reference Question: C# Stackoverflow Same Issue
Sample XML:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MySample xmlns:ns0="someurl" xsi:schemaLocation="someOtherurl">
<othertag/>
</ns0:MySample>
Since it the schemaLocation is an attribute and not a namespace you can simply parse it using @Attribute annotation.
Do not forget to declare the Namespace of the root element:
This worked just fine for me.