Where am I going wrong in my Xml Schema?
Posted
by chobo2
on Stack Overflow
See other posts from Stack Overflow
or by chobo2
Published on 2010-05-03T06:10:33Z
Indexed on
2010/05/03
6:18 UTC
Read the original article
Hit count: 416
Xml
|xml-schema
Hi
I am trying to make a XML Schema but everytime I use it and try to validate my data I get an error.
I get this error:
Validation of the XML Document failed! Error message(s):
Could not find schema information for the element 'Email'. Line: 1 Column:1213
http://www.xmlforasp.net/SchemaValidator.aspx
My Xml file I am trying to validate.
<?xml version="1.0" encoding="utf-8" ?>
<School>
<SchoolPrefix>BCIT</SchoolPrefix>
<TeacherAccounts>
<Account>
<StudentNumber>A00140000</StudentNumber>
<Password>123456</Password>
<Email>[email protected]</Email>
</Account>
<Account>
<StudentNumber>A00000041</StudentNumber>
<Password>1234567</Password>
<Email>[email protected]</Email>
</Account>
<Account>
<StudentNumber>A0400100</StudentNumber>
<Password>1234567</Password>
<Email>[email protected]</Email>
</Account>
</TeacherAccounts>
<FullTimeAccounts>
<Account>
<StudentNumber>A00000000</StudentNumber>
<Password>1234567</Password>
<Email>[email protected]</Email>
</Account>
<Account>
<StudentNumber>A00141000</StudentNumber>
<Password>1234567</Password>
<Email>[email protected]</Email>
</Account>
</FullTimeAccounts>
<PartTimeAccounts>
<Account>
<StudentNumber>A81020409</StudentNumber>
<Password>1234567</Password>
<Email>[email protected]</Email>
</Account>
<Account>
<StudentNumber>A040014000</StudentNumber>
<Password>1234567</Password>
<Email>[email protected]</Email>
</Account>
<Account>
<StudentNumber>A00024040</StudentNumber>
<Password>1234567</Password>
<Email>[email protected]</Email>
</Account>
<Account>
<StudentNumber>A00004101</StudentNumber>
<Password>1234567</Password>
<Email>[email protected]</Email>
</Account>
</PartTimeAccounts>
</School>
XMl Schema
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.nothing.com"
xmlns="http://www.nothing.com"
elementFormDefault="qualified">
<xs:element name="School">
<xs:complexType>
<xs:sequence>
<xs:element name="SchoolPrefix" minOccurs="1" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="2" />
<xs:maxLength value="8" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TeacherAccounts" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Account" type="UserInfo" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="FullTimeAccounts">
<xs:complexType>
<xs:sequence>
<xs:element name="Account" type="UserInfo" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="PartTimeAccounts">
<xs:complexType>
<xs:sequence>
<xs:element name="Account" type="UserInfo" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="UserInfo">
<xs:sequence>
<xs:element name="StudentNumber">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Password">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="6"/>
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Email">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
© Stack Overflow or respective owner