users@jaxb.java.net

Unexpected end of element - URGENT Please help.

From: Sree Pillai <sree_b_pillai_at_yahoo.com>
Date: Wed, 8 Oct 2003 14:32:19 -0700 (PDT)

I am trying to make the import schemas to work so that
I can have my shared elements in common schema.

a2kcore.xsd (shared schema)
===========

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

        xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
jxb:version="1.0"

xmlns="http://alexandria.carlson.com/2003/schemas/core"

targetNamespace="http://alexandria.carlson.com/2003/schemas/core"
        elementFormDefault="qualified">
        <xs:annotation>
                <xs:appinfo>
                        <jxb:schemaBindings>
                                <jxb:package
name="com.carlson.alexandria.xmlinterface.a2kcore" />
                        </jxb:schemaBindings>
                </xs:appinfo>
        </xs:annotation>

        <xs:element name="Header">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element ref="DocumentID"/>
                                <xs:element ref="MessageID"/>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
        <xs:element name="DocumentID" type="xs:string"/>
        <xs:element name="MessageID" type="xs:string"/>
</xs:schema>

a2kenrollmentreq.xsd (Imports a2kcore.xsd)
=========================================
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

        xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
jxb:version="1.0"

xmlns="http://alexandria.carlson.com/2003/schemas/enrollment"

xmlns:core="http://alexandria.carlson.com/2003/schemas/core"


targetNamespace="http://alexandria.carlson.com/2003/schemas/enrollment"
        elementFormDefault="qualified">
        <xs:annotation>
                <xs:appinfo>
                        <jxb:schemaBindings>
                                <jxb:package
name="com.carlson.alexandria.xmlinterface.a2kenrollmentreq"/>
                        </jxb:schemaBindings>
                </xs:appinfo>
        </xs:annotation>
        <xs:import
namespace="http://alexandria.carlson.com/2003/schemas/core"
schemaLocation="A2Kcore.xsd"/>
        <xs:element name="A2KEnrollmentReq">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element ref="core:Header"/>
                        </xs:sequence>
                        <xs:attribute name="Version" type="xs:string"
use="required"/>
                        <xs:attribute name="RequestType" use="required">
                                <xs:simpleType>
                                        <xs:restriction base="xs:string">
                                                <xs:enumeration value="original"/>
                                                <xs:enumeration value="resend"/>
                                        </xs:restriction>
                                </xs:simpleType>
                        </xs:attribute>
                </xs:complexType>
        </xs:element>
</xs:schema>

I generated JAXB classes using xjc.bat. The following
is my script for generation. The classes gets
generated in the correct packages specified in xsds.

set JAVA_HOME=c:\jdk1.3.1
set JAXB_HOME=C:\jwsdp-1.1\jaxb-1.0
set JAXB_LIBS=%JAXB_HOME%\lib
set XALAN_LIB=c:\xalan-j_2_5_0\bin
set
CLASSPATH=%JAXB_LIBS%\jaxb-api.jar;%JAXB_LIBS%\jaxb-ri.jar;%JAXB_LIBS%\jaxb-xjc.jar;%JAXB_LIBS%\jaxb-libs.jar;%JAXB_LIBS%\jaxp-api.jar;%XALAN_LIB%\xercesImpl.jar;%XALAN_LIB%\xml-apis.jar;
call %JAXB_HOME%\bin\xjc.bat A2KEnrollmentReq.xsd -d
source

When I try to unmarshall file oe.xml

            A2KEnrollmentReq ao =
                (A2KEnrollmentReq)u.unmarshal( new
FileInputStream( "oe.xml" ) );

I get Unexpected end of element {}:DocumentID
exception.

Listing - oe.xml
======

<?xml version="1.0" encoding="UTF-8"?>
<ns:A2KEnrollmentReq
xmlns:ns="http://alexandria.carlson.com/2003/schemas/enrollment"
xmlns:core="http://alexandria.carlson.com/2003/schemas/core"
Version="String" RequestType="original">
   <core:Header>
     
<core:DocumentID>100000000000021</core:DocumentID>

     
<core:MessageID>2003-06-20T10:56:45</core:MessageID>
   </core:Header>
</ns:A2KEnrollmentReq>






__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net