[jboss-dev-forums] [Design of JBossXB] - Unmarshaller: xsd:choice with minOccurs

anil.saldhana@jboss.com do-not-reply at jboss.com
Thu Aug 16 16:30:56 EDT 2007


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074982#4074982

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074982



More information about the jboss-dev-forums mailing list