users@jaxb.java.net

Unmarshalling ignores value of anyType element

From: fcamous <fabrice.camous_at_dit.ie>
Date: Tue, 1 Dec 2009 09:55:16 -0800 (PST)

Hi all,

I'm having problem accessing a value contained in an anyType element:

I have this data type called "varies" in my schema:
<xsd:complexType name="varies">
<xsd:complexContent>
<xsd:extension base="xsd:anyType"/>
</xsd:complexContent>
</xsd:complexType>

xjc generates Varies.java and I have an getter to access the value:
public List<Element> getAny() {
if (any == null) {
any = new ArrayList<Element>();
}
return this.any;
}

I'm unmarshalling an xml document and this is the part I am interested in:
<OBX.5>
6.4
</OBX.5>

"OBX.5" is an extension of "varies" type.
xjc generates OBX5CONTENT.java which inherits the getAny() method. However,
after unmarshalling, when I use the method in my code, the list of
org.w3c.dom.Element objects it returns is always empty. Note that I have
access to other fields of the OBX5CONTENT object without a problem.
Any idea?
Thanks in advance.

Here's the OBX.5 schema definition if it's needed:
<xsd:attributeGroup name="OBX.5.ATTRIBUTES">
<xsd:attribute name="Item" type="xsd:string" fixed="573"/>
<xsd:attribute name="Type" type="xsd:string" fixed="varies"/>
<xsd:attribute name="LongName" type="xsd:string" fixed="Observation Value"/>
</xsd:attributeGroup>
<xsd:complexType name="OBX.5.CONTENT">
<xsd:annotation>
<xsd:documentation xml:lang="en">Observation Value</xsd:documentation>
<xsd:appinfo>
<hl7:Item>573</hl7:Item>
<hl7:Type>varies</hl7:Type>
<hl7:LongName>Observation Value</hl7:LongName>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="varies">
<xsd:attributeGroup ref="OBX.5.ATTRIBUTES"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="OBX.5" type="OBX.5.CONTENT"/>
-- 
View this message in context: http://old.nabble.com/Unmarshalling-ignores-value-of-anyType-element-tp26595595p26595595.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.