users@jaxb.java.net

javax.xml.bind.UnmarshalException: Unexpected end of element {}:

From: Sree Pillai <sree_b_pillai_at_yahoo.com>
Date: Mon, 28 Apr 2003 20:01:11 -0600

While unmarshalling this instance document, I get the following exception.

javax.xml.bind.UnmarshalException: Unexpected end of element {}:dsname

 at com.sun.xml.bind.unmarshaller.UnreportedException.createUnmarshalException(UnreportedException.java:58)

 at com.sun.xml.bind.unmarshaller.SAXUnmarshallerHandlerImpl.reportAndThrow(SAXUnmarshallerHandlerImpl.java:498)

 at com.sun.xml.bind.unmarshaller.SAXUnmarshallerHandlerImpl.endElement(SAXUnmarshallerHandlerImpl.java:130)

 at org.iso_relax.verifier.impl.ForkContentHandler.endElement(Unknown Source)

 at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

 at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)

 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

 at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

 at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

 at com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:130)

 at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:139)

 at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:186)

My schema file is

<xsd:schema targetNamespace="http://www.testschema.com/2003/GlobalSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.testschema.com/2003/GlobalSchema" elementFormDefault="qualified">
 <xsd:element name="globalschema" type="GlobalschemaType"/>
 <xsd:complexType name="GlobalschemaType">
   <xsd:sequence>
     <xsd:element name="datasource" type="DatasourceType"/>
   </xsd:sequence>
 </xsd:complexType>
 <xsd:complexType name="DatasourceType">
   <xsd:sequence>
     <xsd:element name="dsname" type="xsd:string"/>
     <xsd:element name="type" type="xsd:string"/>
     <xsd:element name="driver" type="xsd:string"/>
     <xsd:element name="url" type="xsd:string"/>
     <xsd:element name="username" type="xsd:string"/>
     <xsd:element name="password" type="xsd:string"/>
   </xsd:sequence>
 </xsd:complexType>
</xsd:schema>

My instance is

<?xml version="1.0"?>
<globalschema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://www.testschema.com/2003/GlobalSchema">
 <datasource>
         <dsname>ScottSchema</dsname>
  <type>oracle</type>
  <driver>oracle.jdbc.driver.OracleDriver</driver>
  <url>jdbc:thin_at_w154048.carlson.com:1521:sqlmyst</url>
  <username>scott</username>
  <password>tiger</password>
 </datasource>
</globalschema>


Any ideas? It seems like a namespace issue.

Thanks in advance,
Sree Pillai