1

I want to add xmlns:xsi and xsi:noNamespaceSchemaLocation in an xml root element.
I need something like this:

<Product xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="product_1.xsd">

i tried using the code below:

JAXBContext contextObj = JAXBContext.newInstance(Product.class);
Marshaller marshallerObj = contextObj.createMarshaller();
marshallerObj.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshallerObj.setProperty(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, "product_1.xsd");

The code, however, generated this output:

<IMARKET xsi:noNamespaceSchemaLocation="product_1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Why is it getting reversed? Is there any way to maintain the order?

0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.