14
I have an XML file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object>
<str>the type</str>
<bool type="boolean">true</bool>
</object>
And I want to unmarshal it to an object of the class below
@XmlRootElement(name="object")
public class Spec {
public String str;
public Object bool;
}
How can I do this? Unless I specify namespaces (see below), it doesn't work.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object>
<str>the type</str>
<bool xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xsi:type="xs:boolean">true</bool>
</object>