[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
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 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.