Namspace error in Jibx:
I have created an xsd file to test out the namespaces in Jibx.
When I run it thru xsd2jibx and then java roundtrip utility.
I get org.jibx.runtime.JiBXException: Expected
"{http://test.jibx.namespace}ResponseData" end tag, found "ID" end tag
I am including the xsd file, xml file , commands and Stack Trace I ran.
In my opion both the xsd and xml are good. I have used WSAD (WebSphere
Studio Application Developer 5.1.1) to generate the
xsd and xml files.
I will appreciate, if someone can point out what I am doing wrong.
Thanks,
############################ START XSD File ###########################
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test.jibx.namespace"
xmlns="http://test.jibx.namespace">
<xsd:element name="Response" type="ResponseType"></xsd:element>
<xsd:element name="ResponseError"
type="ResponseErrorType"></xsd:element>
<xsd:element name="ResponseData"
type="ResponseDataType"></xsd:element>
<xsd:complexType name="ResponseType">
<xsd:sequence>
<xsd:element ref="ResponseData"
minOccurs="0" maxOccurs="1"></xsd:element>
<xsd:element ref="ResponseError"
minOccurs="0" maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ResponseDataType">
<xsd:sequence>
<xsd:element name="ID" type="xsd:string"
minOccurs="0" maxOccurs="1"></xsd:element>
<xsd:element name="lastname" type="xsd:string"
minOccurs="0" maxOccurs="1"></xsd:element>
<xsd:element name="firstname" type="xsd:string"
minOccurs="0" maxOccurs="1"></xsd:element>
<xsd:element name="middlename" type="xsd:string"
minOccurs="0" maxOccurs="1"></xsd:element>
<xsd:element name="dateofbirth" type="xsd:string"
minOccurs="0" maxOccurs="1"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ResponseErrorType">
<xsd:sequence>
<xsd:element name="severity"
type="xsd:string" minOccurs="0" maxOccurs="1"></xsd:element>
<xsd:element name="message"
type="xsd:string" minOccurs="0" maxOccurs="1"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
############################ END XSD File ###########################
############################ START XML File ###########################
<?xml version="1.0" encoding="UTF-8"?>
<testJibx:Response xmlns:testJibx="http://test.jibx.namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test.jibx.namespace JibxTestNamespace.xsd ">
<testJibx:ResponseData>
<ID>ID</ID>
<lastname>lastname</lastname>
<firstname>firstname</firstname>
<middlename>middlename</middlename>
<dateofbirth>dateofbirth</dateofbirth>
</testJibx:ResponseData>
<testJibx:ResponseError>
<severity>severity</severity>
<message>message</message>
</testJibx:ResponseError>
</testJibx:Response>
############################ END XML File ###########################
############################ START Commands ###########################
xsd2jibx JibxTestNamespace.xsd
cd src-gen\namespace\jibx\test\
javac *.java
cd ..\..\..
jibx-bind namespace\jibx\test\test.jibx.xml
java -cp %XSD2JIBX_CLASSPATH% TestRoundtrip namespace.jibx.test.ResponseType
..\JibxTestNamespace.xml
############################ END Commands ###########################
############################ START Stack Trace ########################
org.jibx.runtime.JiBXException: Expected
"{http://test.jibx.namespace}ResponseData" end tag, found "ID" end tag (line
4, co
16)
at
org.jibx.runtime.impl.UnmarshallingContext.throwEndTagNameError(Unmarshallin
gContext.java:307)
at
org.jibx.runtime.impl.UnmarshallingContext.parsePastEndTag(UnmarshallingCont
ext.java:829)
at namespace.jibx.test.JiBX_testResponseDataType_access.unmarshal()
at
namespace.jibx.test.ResponseType.JiBX_test_unmarshal_1_0(ResponseType.java)
at namespace.jibx.test.JiBX_testResponseType_access.unmarshal()
at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingCon
text.java:2614)
at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingCo
ntext.java:2782)
at TestRoundtrip.runTest(TestRoundtrip.java:83)
at TestRoundtrip.main(TestRoundtrip.java:146)
Error round-tripping class: namespace.jibx.test.ResponseType
with input file ..\JibxTestNamespace.xml and output compared to
..\JibxTestNamespace.xml
Saved output document file path
C:\ECSWorkspace\RequestResponseSchema\src-gen\temp.xml
############################ END Stack Trace ########################
Yogesh
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users