Hi all,

I get a JiBXException when I tried to unmarshall the following very simple
XML document:

<style name="header">
<font face="Arial"/>
<color value="#FFE9E9E9"/>
</style>

However, if I swap the order of <font> and <color> (so that <color> comes
before <font>), then no exception is raised.

The schema is as follow:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified">
        <xs:element name="style">
                <xs:complexType>
                        <xs:all>
                                <xs:element ref="color" minOccurs="0"
maxOccurs="1" />
                                <xs:element ref="font" minOccurs="0"
maxOccurs="1" />
                        </xs:all>
                        <xs:attribute name="name" use="required"
type="xs:string" />
                </xs:complexType>
        </xs:element>
        <xs:element name="font">
                <xs:complexType>
                        <xs:attribute name="face" use="optional"
type="xs:string" />
                </xs:complexType>
        </xs:element>
        <xs:element name="color">
                <xs:complexType>
                        <xs:attribute name="value" type="xs:string"
use="required" />
                </xs:complexType>
        </xs:element>
</xs:schema>

And the exception raised is as follow:

runcust:
     [echo] Running the sample application...
     [java] Exception in thread "main" org.jibx.runtime.JiBXException:
Expected "style" end tag, found "color" start tag (line 3, col 27)
     [java]     at
org.jibx.runtime.impl.UnmarshallingContext.parsePastCurrentEndTag(UnmarshallingContext.java:736)
     [java]     at hoolam.JiBX_bindingStyle_access.unmarshal()
     [java]     at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2762)
     [java]     at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2905)
     [java]     at hoolam.Test.main(Test.java:20)
     [java] Unmarshalling ABC1.padl

It seems to me JiBX doesn't handle <xs:all> correctly, in that <xs:all>
describes an unordered group of elements but JiBX insists on the order as
elements appear in XSD.

Can anyone help?

Thanks in advance.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to