1 Reply Latest reply on Aug 17, 2007 3:45 AM by aloubyansky

    Unmarshaller: xsd:choice with minOccurs

    anil.saldhana

      Suppose, I have the following XSD bit:


      <xsd:element name="application-policy">
       <xsd:complexType>
       <xsd:sequence>
       <xsd:choice minOccurs="0">
       <xsd:element ref="jbsx:authentication"/>
       <xsd:element ref="jbsx:authentication-jaspi"/>
       </xsd:choice>
       <xsd:element ref="jbsx:authorization" minOccurs="0"/>
      
       </xsd:sequence>
       </xsd:complexType>
      </xsd:element>
      


      I get the following exception:
      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Requested element {urn:
      jboss:security-config:5.0}authorization is not allowed in this position in the s
      equence. A model group with minOccurs=1 that doesn't contain this element must follow.
       at org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding$1.startElem
      ent(SequenceBinding.java:271)
       at org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding$Cursor.st
      artElement(ModelGroupBinding.java:185)
       at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startE
      lement(SundayContentHandler.java:280)
       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHan
      dler.startElement(SaxJBossXBParser.java:381)
       at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
      ce)
      


      It seems that XB does not like an xsd:choice with minOccurs/maxOccurs.

      My xml looks like:
      <jbsx:application-policy name="jboss-web-policy">
       <jbsx:authorization>
       <jbsx:policy-module code="org.jboss.security.authorization.modules.DelegatingAuthorizationModule" flag="required"/>
       </jbsx:authorization>
      </jbsx:application-policy>
      


      I am trying to avoid the optional authentication element.