Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-346

Getting ClassCastException if the same root element exist in different XSD

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • Version 2.2
    • unspecified
    • XmlObject
    • None
    • Windows xp operating system , jdk 1.4, WebLogic Server.

    Description

      HI All!

      I created the below XSD with two different packages.

      1) Package structure as follows
      -> test.xmlbeans.one
      -> test.xmlbeans.two

      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

      <xs:element name="cXML">
      <xs:complexType>
      <xs:sequence>
      <xs:element ref="HEADER"/>

      </xs:sequence>

      </xs:complexType>
      </xs:element>

      <xs:element name="HEADER">
      <xs:complexType>
      <xs:sequence>
      <xs:element ref="From"/>
      <xs:element ref="To"/>
      <xs:element ref="Sender"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>

      2) jar file generated successfully. While executing the below program i found ClassCastException.

      java.lang.ClassCastException: test.xmlbeans.one.CXMLDocumentImpl
      at test.xmlbeans.two.CXMLDocument$Factory.parse(CXMLDocument.java)

      This is the sample program

      class TextXMlBeans{
      public static void main(String arg[]) trhows Exception

      { test.xmlbeans.two.CXMLDocument cxml = test.xmlbeans.two.CXMLDocument.Factory.parse(new File(fileName), opt); }

      }

      Thanks,
      Rajasekhar

      Attachments

        Activity

          People

            Unassigned Unassigned
            rajasekharjuluri rajasekhar juluri
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: