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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Version 2.5
    • Fix Version/s: None
    • Component/s: XmlObject
    • Labels:
      None
    • Environment:
      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

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

              Dates

              • Created:
                Updated: