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

org.apache.xmlbeans.impl.values.XmlAnyTypeImpl cannot be cast to AttachmentType

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Version 2.5
    • None
    • XmlObject
    • None
    • Jboss7 application serverver and windows XP environment

    Description

      I am getting above exception

      here is my sample xsd e:
      <xsd:choice>
      <xsd:element name="UploadMetadata" type="AttachmentType" />
      <xsd:element name="ExportMetadata" type="AttachmentType" />
      </xsd:choice>

      <xsd:complexType name="AttachmentType">
      <xsd:sequence>
      <xsd:element name="FileName" type="xsd:string" minOccurs="1" />
      <xsd:element name="FileType" type="xsd:string" minOccurs="1" />
      <xsd:element name="BinaryData" type="xsd:base64Binary"
      minOccurs="1" />
      </xsd:sequence>
      </xsd:complexType>

      it's failing in the following java code

      AttachmentType attachmentType = null;

      if (upldMetadataReqType.isSetUploadMetadata())

      { //it's working for getUploadMetaData() attachmentType = upldMetadataReqType.getUploadMetadata(); }

      else

      { // getting the error when i am trying to access getExportmetadata() attachmentType = upldMetadataReqType.getExportMetadata(); }

      Attachments

        Activity

          People

            Unassigned Unassigned
            jakkamsetti Adinarayana
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: