W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2006

Re: Schema Not working

From: Anne van Rossum <anne4theweb@yahoo.com>
Date: Sat, 26 Aug 2006 21:03:11 +0200
Message-Id: <6.1.2.0.0.20060826163252.028ae348@127.0.0.1>
To: xmlschema-dev@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 26 August 2006 19:08:24 GMT