title: How to remove xmlns:xsi and xsi:type from JAXB marshalled XML file
body: <p>I've got a set of JAXB generated classes and some of the classes have setter methods which accepts
  "Object" as the parameter. For example:</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name="Car", propOrder = {
      "defaultCar"
  } 
  
  public class Car {
    @XmlElement(name = "DefaultCar") 
    protected Object defaultcar;  
  
    public void setDefaultCar(Object value) {
      this.defaultCar = value;
  }
  </code></pre>
  
  <p>After I've created instances of these classes in my code, I call the setter methods passing in the required value. Although the method's parameter is Object, the values are most likely to be strings (I've got no control over how it is defined). However, to keep things consistent, I cast the string to Object so that it matches the method's parameter type. The code looks something like this:</p>
  
  <pre><code>    Object value = "Old Banger";
      Method method = aCar.getClass().getMethod("setDefaultCar", Object.class);
      method.invoke(aCar, value);
  </code></pre>
  
  <p>When I marshall the Java objects, I get the following within the resulting XML, just in front of the value of the string:</p>
  
  <pre>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string" </pre> 
  
  <p>I've read somewhere about mismatching data types between the method's parameter type and what has been passed to it. In my case the method parameter being "Object" but I'm passing in a string to it (although I've cast it to Object). I've also seen this post and it looks similar to my problem:</p>
  
  <p><a href="https://stackoverflow.com/questions/20679163/xsitype-and-xmlnsxsi-in-generated-xml-by-jaxb">&quot;xsi:type&quot; and &quot;xmlns:xsi&quot; in generated xml by JAXB</a></p>
  
  <p>However, it doesn't help me overcome my problem. Is there a way to remove these references to xmlns:xsi and xsi:type?</p>
  
  <p>Thx</p>