Hi
On 17/04/14 11:04, Pradeep Fernando wrote:
Hi Devs,

I'm using CXF Jax-rs libs. Did some google searching on the $subject and
since im using,

org.apache.cxf.jaxrs.provider.json.JSONProvider, i made use of

org.apache.cxf.jaxrs.utils.schemas.SchemaHandler to validate my input
against my schema.

I get an input similar, to,

{
       "id": "AWSEC2AsiaPacificPartition1",
       "provider": "ec2",
       "property": [
           {
             "name": "region",
             "value": "ap-southeast-1"
           }
       ],
       "partitionMin": "1",
       "partitionMax": "3"
}

I cant figure out how to model property array in xmlSchema without using a
wrapping element. And it gives an error at the moment.

The schema portion i use to validate the property array..

                <xs:element name="property" minOccurs="1" maxOccurs="1">
                     <xs:complexType>
                         <xs:sequence>
                             <xs:element name="property" minOccurs="0"
maxOccurs="unbounded">
                                 <xs:complexType>
                                     <xs:sequence>
                                         <xs:element name="name"
minOccurs="1" maxOccurs="1" nillable="false"/>
                                         <xs:element name="value"
minOccurs="1" maxOccurs="1" nillable="false"/>
                                     </xs:sequence>
                                 </xs:complexType>
                             </xs:element>
                         </xs:sequence>
                     </xs:complexType>
                 </xs:element>


Am i doing the correct thing, May be im missing a trivial thing.  Is it
possible at all.


<xs:element name="property" minOccurs="1" maxOccurs="unbounded">
   <xs:complexType>
       <xs:sequence>
          <xs:element name="name" nillable="false"/>
          <xs:element name="value" nillable="false"/>
       </xs:sequence>
  </xs:complexType>
</xs:element>

Should probably do it

Note, Bean Validation 1.1 is also supported in 3.0.0-milestone2

Cheers, Sergey


thanks in advance...
--Pradeep



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to