Re: Schema Not working

Hi Satya,

Don't know what your objectives are. But anyway, the way you close the 
elements in your schema is not correct. These elements should be in this 
way: </xs:sequence> etc. So

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://example.com">
   <xs:element name="person">
     <xs:complexType>
       <xs:sequence>
         <xs:element name="familyName" type="xs:integer" />
         <xs:element name="firstName" type="xs:string" />
       </xs:sequence>
     </xs:complexType>
   </xs:element>
</xs:schema>

And secondly, familyName is defined as integer so this xml-file is invalid:

<foo:person xmlns:foo="http://example.com">
   <familyName> test </familyName>
   <firstName> Kohsuke </firstName>
</foo:person>

You can check it for yourself using one of a dozen 
<http://tools.decisionsoft.com/schemaValidate/>online validators. With some 
you can only use more or less "official" schemas, with others you have to 
enter URLs and with some you can enter files from your local system.

Enjoy!

Andy

At 04:29 26-8-2006, Babu Gummadi wrote:

>Hi,
>
>   I am new to XML Schemas, I am learning now, I wrote an xml file and 
> schema to validate that xml file. i applyed xsd on that, Still its not 
> validating the xml and just displaying the xml text on browser, Please 
> help me to resolve the issue
>
>   here is my XSD:
>
>   <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>       targetNamespace="http://example.com">
>   <xs:element name="person">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element name="familyName" type="xs:integer" />
>         <xs:element name="firstName" type="xs:string" />
>       <xs:sequence>
>     <xs:complexType>
>   <xs:element>
><xs:schema>
>
>
>   XML File
>   <foo:person xmlns:foo="http://example.com">
>   <familyName> test </familyName>
>   <firstName> Kohsuke </firstName>
></foo:person>
>
>
>
>   Regards
>   Satya

Received on Saturday, 26 August 2006 19:08:23 UTC