Are you using JAXB?  It's doesn't validate many types of constraints.  I
believe XMLBeans does a better job, but haven't used it before.

Glen


jimmy6 wrote:
> 
> How come the following restriction not working? Suppose it can only pass
> in A and C. But why my following code is able to pass through?
>       HelloWorld helloWorld = new HelloWorld();
>               helloWorld.setType(HelloWorld.Type.B);
>               WebClient client = WebClient.create("http://127.0.0.1:8080/";);
>               Response r =
> client.path("rest/api/rest/helloWorldService/.xml").accept("text/xml").post(helloWorld);
> 
> <jaxrs:schemaLocations>
> 
> <jaxrs:schemaLocation>classpath:com.abc.sample.cxf.helloWorld.xsd</jaxrs:schemaLocation>
> </jaxrs:schemaLocations>
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
> xmlns:tns="http://127.0.0.1:8080"; elementFormDefault="qualified"
> targetNamespace="http://127.0.0.1:8080";>
>   <xs:element type="tns:HelloWorld" name="HelloWorld"/>
>   <xs:complexType name="HelloWorld">
>     <xs:annotation>
>       <xs:documentation>Hello world object that demonstrates the
> service</xs:documentation>
>     </xs:annotation>
>     <xs:sequence>
>       <xs:element type="xs:string" name="message">
>         <xs:annotation>
>           <xs:documentation>the message</xs:documentation>
>         </xs:annotation>
>       </xs:element>
>       <xs:element name="type">
>         <xs:simpleType>
>           <xs:restriction base="xs:string">
>             <xs:enumeration value="A"/>
>             <xs:enumeration value="C"/>
>           </xs:restriction>
>         </xs:simpleType>
>       </xs:element>
>     </xs:sequence>
>     <xs:attribute type="xs:dateTime" use="required" name="date"/>
>     <xs:attribute type="xs:int" use="required" name="integer"/>
>     <xs:attribute type="xs:boolean" use="required" name="enable"/>
>   </xs:complexType>
> </xs:schema>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/xsd-validation-no-checking.-why--tp28726073p28742431.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to