You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by AMIE project developers <am...@gmail.com> on 2005/12/08 22:21:36 UTC

javax.xml.bind.UnmarshalException: Unexpected end element

Hi all,

I am using JaxMe for a web application, and when I was trying to
unmarshall the contents of an XML file into a Java Object, I get this
exception:
javax.xml.bind.UnmarshalException: Unexpected end element:
'{http://amie/system/common/generated/usersSchema}User'

Any ideas? I don't really know if it's because the XML does not contain
all the fields specified in the schema... the default values are
minOccurs="0" and maxOccurs="1", aren't they?

I am sure that it will be some stupid thing I forgot... but I have been
dealing with it for hours...

Thank you in advance for your reply!

Aleks



Well, this is my XML file...
<Users xmlns='http://amie/system/common/generated/usersSchema'
  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
    <User>
        <shortname>admin</shortname>
        <password></password>
    </User>
</Users>



And this is the schema...
---------------------------------------------------------------------
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:ns="http://amie/system/common/generated/usersSchema"

targetNamespace="http://amie/system/common/generated/usersSchema"
            elementFormDefault="qualified">
    
    
   <xsd:element name="Users" type="ns:UserListType">
     <xsd:unique name="Users-uniqueness">
       <xsd:selector xpath="ns:User"/>
       <xsd:field    xpath="ns:shortname"/>
     </xsd:unique>
   </xsd:element>

   <xsd:complexType name="UserListType">
     <xsd:sequence>
         <xsd:element name="User" type="ns:UserType"
maxOccurs="unbounded"/>
     </xsd:sequence>
   </xsd:complexType>
    
    <xsd:complexType name="UserType">
        <xsd:sequence>
            <xsd:element name="shortname" type="xsd:string"
minOccurs="1"/>
            <xsd:element name="password" type="xsd:string"
minOccurs="1"/>
            <xsd:element name="fullname" type="xsd:string"/>
            <xsd:element name="email" type="xsd:string"
maxOccurs="unbounded"/>
            <xsd:element name="privileges" type="ns:UserPrivileges"
maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
    
    <xsd:complexType name="UserPrivileges">
        <xsd:sequence>
            <xsd:element name="appId" type="xsd:string" minOccurs="1"/>
            <xsd:element name="level" type="xsd:string" minOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>

</xsd:schema>




---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: javax.xml.bind.UnmarshalException: Unexpected end element

Posted by Jochen Wiedmann <jo...@gmail.com>.
AMIE project developers wrote:

> all the fields specified in the schema... the default values are
> minOccurs="0" and maxOccurs="1", aren't they?

No, the default values are 1 for both minOccurs and maxOccurs.

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org