Note that there are some explanatory texts on larger screens.

plurals
  1. POXmlDiscriminatorNode, XmlSchema namespace, and elementFormDefault=QUALIFIED
    primarykey
    data
    text
    <p>I'm using eclipselink-2.3.2. My package is annotated:</p> <p><code>@XmlSchema(namespace = "http://example.com/namespace", elementFormDefault = XmlNsForm.QUALIFIED)</code></p> <p>I have the following classes:</p> <pre><code>@XmlRootElement public class Box { private A item; // and getter/setter } @XmlDiscriminatorNode("@thetype") public abstract class A {} @XmlDiscriminatorValue("b") public class B extends A {} @XmlDiscriminatorValue("c") public class C extends A {} </code></pre> <p>When I try to deserialize valid XML like this:</p> <p><code>&lt;box xmlns="http://example.com/namespace"&gt;&lt;a thetype="b" /&gt;&lt;/box&gt;</code></p> <p>I get the descriptive exception:</p> <pre><code>org.eclipse.persistence.exceptions.DescriptorException Exception Description: Missing class indicator field from database row [UnmarshalRecord()] </code></pre> <p>If I remove the <code>@XmlSchema</code> from the package and the <code>xmlns</code> attribute from the root element, it works. If I change from QUALIFIED to UNQUALIFIED, it works as long as I feed it the ugly prefixed XML.</p> <p>I assumed that the unprefixed would work since it still declares the default namespace, but although there is no exception the field remains null.</p> <p>After stepping through the EclipseLink code, I can see that when <code>QNameInheritancePolicy.classFromRow</code> calls <code>UnmarshalRecord.get</code>, it is trying to access the attribute "thetype" under the namespaceURI "http://example.com/namespace".</p> <p>When I change the XmlScehma elementFormDefault to UNQUALIFIED, the namespaceURI comes back null and the attribute is properly retrieved.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload