Hi all,
It seems that JiBX can't handle this schema properly
1 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema
xmlns="http://jibx.org/starter" elementFormDefault="qualified"
targetNamespace="http://jibx.org/starter">
2 <xs:element name="product">
3 <xs:complexType>
4 <xs:sequence>
5 <xs:element ref="productName"/>
6 </xs:sequence>
7 </xs:complexType>
8 </xs:element>
9 <xs:element name="productName" type="xs:string"/>
10 </xs:schema>
Unmarshalling this XML throws JiBXException:
1 <product xmlns="http://jibx.org/starter">
2 <productName>xyz</productName>
3 </product>
Exception in thread "main" org.jibx.runtime.JiBXException: Expected
"{http://jibx.org/starter}productName" start tag, found
"{http://jibx.org/starter}productName" end tag (line 2, col 35)
at
org.jibx.runtime.impl.UnmarshallingContext.matchStart(UnmarshallingContext.java:652)
at
org.jibx.runtime.impl.UnmarshallingContext.parsePastStartTag(UnmarshallingContext.java:685)
at
org.jibx.runtime.impl.UnmarshallingContext.parseElementText(UnmarshallingContext.java:940)
at org.jibx.starter.ProductName.JiBX_binding_unmarshal_1_0(Unknown
Source)
at org.jibx.starter.JiBX_bindingProductName_access2.unmarshal()
at org.jibx.starter.Product.JiBX_binding_unmarshal_1_0(Unknown Source)
at org.jibx.starter.JiBX_bindingProduct_access2.unmarshal()
at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2762)
at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2919)
The problem is that we reference productName (line 5), which is defined as a
primitive (line 9). If we change the line 5 to
<xs:element name="productName" type="xs:string"/>
And remove line 9, JiBX would have worked fine(in the default mode).
Does anyone know how to resolve this issue? Changing the schema is not an
option because we don't define/control the schema.
Thanks.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users