[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jibx-users
Subject:    [jibx-users] JiBXException when unmarshalling a valid XML
From:       "Wang, Lei1 " <lei1.wang () citi ! com>
Date:       2009-07-28 12:59:56
Message-ID: 6E2C77074744C241B6779E5832D588F8024DE48EDA () exnjmb86 ! nam ! nsroot ! net
[Download RAW message or body]

Hi,

I am using JiBX 1.21.1 on Windows XP. Given the following schema

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns="http://jibx.org/starter" targetNamespace="http://jibx.org/starter">
        <xs:element name="product">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element ref="productName"></xs:element>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>

        <xs:element name="productName" type="xs:string"/>
</xs:schema>

No problem with codegen and binding. But when I unmarshal this XML:

<product xmlns="http://jibx.org/starter">
    <productName>xyz</productName>
</product>

I received JiBXException:

     [java] 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)
     [java]     at org.jibx.runtime.impl.UnmarshallingContext.matchStart(UnmarshallingContext.java:652)
                
     [java]     at org.jibx.runtime.impl.UnmarshallingContext.parsePastStartTag(UnmarshallingContext.java:685)
                
     [java]     at org.jibx.runtime.impl.UnmarshallingContext.parseElementText(UnmarshallingContext.java:940)
                
     [java]     at org.jibx.starter.ProductName.JiBX_binding_unmarshal_1_0(Unknown \
                Source)
     [java]     at org.jibx.starter.JiBX_bindingProductName_access.unmarshal()
     [java]     at org.jibx.starter.Product.JiBX_binding_unmarshal_1_0(Unknown \
Source)  [java]     at org.jibx.starter.JiBX_bindingProduct_access.unmarshal()
     [java]     at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2762)
                
     [java]     at org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2919)


Does anyone know what happened? It is a simple schema and XML is valid.

Thanks in advance.


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 \
2px solid; } --></style> </head>
<body>
<font face="Arial, sans-serif" size="2">
<div>Hi,</div>
<div>&nbsp;</div>
<div>I am using JiBX 1.21.1 on Windows XP. Given the following schema</div>
<div>&nbsp;</div>
<div>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</div>
<div>&lt;xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;</div>
<div>&nbsp;&nbsp;&nbsp; xmlns=&quot;http://jibx.org/starter&quot; \
targetNamespace=&quot;http://jibx.org/starter&quot;&gt;</div> \
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xs:element \
name=&quot;product&quot;&gt;</div> \
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&lt;xs:complexType&gt;</div> \
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&lt;xs:sequence&gt;</div> \
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&lt;xs:element ref=&quot;productName&quot;&gt;&lt;/xs:element&gt;</div> \
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&lt;/xs:sequence&gt;</div> \
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&lt;/xs:complexType&gt;</div> <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&lt;/xs:element&gt;</div> <div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xs:element \
name=&quot;productName&quot; type=&quot;xs:string&quot;/&gt;</div> \
<div>&lt;/xs:schema&gt;</div> <div>&nbsp;</div>
<div>No problem with codegen and binding. But when I unmarshal this XML:</div>
<div>&nbsp;</div>
<div>&lt;product xmlns=&quot;http://jibx.org/starter&quot;&gt;</div>
<div>&nbsp;&nbsp;&nbsp; &lt;productName&gt;xyz&lt;/productName&gt;</div>
<div>&lt;/product&gt;</div>
<div>&nbsp;</div>
<div>I received JiBXException:</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp; [java] Exception in thread &quot;main&quot; \
org.jibx.runtime.JiBXException: Expected &quot;{<a \
href="http://jibx.org/starter}productName"><font \
color="#0000FF"><u>http://jibx.org/starter}productName</u></font></a>&quot; start \
tag, found &quot;{<a href="http://jibx.org/starter}productName"><font \
color="#0000FF"><u>http://jibx.org/starter}productName</u></font></a>&quot; end tag \
(line 2, col 35)</div> <div>&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; \
at org.jibx.runtime.impl.UnmarshallingContext.matchStart(UnmarshallingContext.java:652)</div>
 <div>&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at \
org.jibx.runtime.impl.UnmarshallingContext.parsePastStartTag(UnmarshallingContext.java:685)</div>
 <div>&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at \
org.jibx.runtime.impl.UnmarshallingContext.parseElementText(UnmarshallingContext.java:940)</div>
 <div>&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at \
org.jibx.starter.ProductName.JiBX_binding_unmarshal_1_0(Unknown Source)</div> \
<div>&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at \
org.jibx.starter.JiBX_bindingProductName_access.unmarshal()</div> \
<div>&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at \
org.jibx.starter.Product.JiBX_binding_unmarshal_1_0(Unknown Source)</div> \
<div>&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at \
org.jibx.starter.JiBX_bindingProduct_access.unmarshal()</div> \
<div>&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at \
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2762)</div>
 <div>&nbsp;&nbsp;&nbsp;&nbsp; [java]&nbsp;&nbsp;&nbsp;&nbsp; at \
org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2919)</div>
 <div>&nbsp;</div>
<div>Does anyone know what happened? It is a simple schema and XML is valid.</div>
<div>&nbsp;</div>
<div>Thanks in advance.</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div><font face="Arial, sans-serif">&nbsp;</font></div>
</font>
</body>
</html>


[Attachment #4 (--===============5708366407826295279==)]
------------------------------------------------------------------------------
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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic