Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-06-2012, 08:11 PM   PM User | #1
alishag229
New to the CF scene

 
Join Date: Aug 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
alishag229 is an unknown quantity at this point
XML Validation with xsd schema

hi guys i am trying to validate my xsd file but i am getting this error

Errors in file lecturers.xsd:
6: 18 s4s-elt-must-match.1: The content of 'lecturers' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: complextype

XSD file

Code:
lecturers.xsd
1	<?xml version="1.0" encoding="UTF-8"?>
2	<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
3	
4	<xs:element name="lecturers">
5	
6	<xs:complextype>
7	<xs:element name="lecturer" minOccurs="1" maxOccurs="1">
8	<xs:complextype>
9	<xs:sequence>
10	<xs:element name="name">
11	<xs:complextype>
12	<xs:attribute name="title" type="xs:string" use="required"/>
13	<xs:attribute name="first" type="xs:string" use="required"/>
14	<xs:attribute name="last" type="xs:string" use="required"/>
15	</xs:complextype>
16	</xs:element>
17	<xs:element name="teaching" minOccurs="1" maxOccurs="unbounded">
18	<xs:complextype>
19	<xs:sequence>
20	<xs:element name="course">
21	<xs:complextype>
22	
23	<xs:simplecontent>
24	<xs:sequence>
25	<xs:extension base="xs:string">
26	<xs:attrbute name="code" type="xs:string" use="required"/>
27	</xs:extension>
28	</xs:sequence>
29	</xs:simplecontent>
30	
31	</xs:complextype>
32	</xs:element>
33	</xs:sequence>
34	</xs:complextype>
35	</xs:element>
36	<xs:element name="research" type="xs:string" minOccurs="0" maxOccurs="1"/>
37	</xs:sequence>
38	</xs:complextype>
39	</xs:element>
40	</xs:complextype>
41	</xs:element>
42	</xs:schema>
and here is the XML file

Code:
<?xml version="1.0" encoding="UTF-8"?>
<request 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 	xsi:noNamespaceSchemaLocation="lecturers.xsd">

<lecturers> 
	<lecturer>
		<name title="Professor" first="Peter" last="Quirk" />
		<teaching>
			<course code="CO3070">XML and the Web</course>
			<course code="CO3300">Web Server Architectures</course>
		</teaching>
		<research>The application of Web protocols to Biology</research>
	</lecturer>
</lecturers>

</request>
please help me find this error
alishag229 is offline   Reply With Quote
Old 08-06-2012, 09:32 PM   PM User | #2
Alex Vincent
Moderator


 
Join Date: May 2002
Location: Hayward, CA
Posts: 1,427
Thanks: 1
Thanked 19 Times in 17 Posts
Alex Vincent is on a distinguished road
Wild guess: does it pass if your XML code has no extraneous white space? (I doubt it, but it's worth a shot.)
__________________
"The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
June 30, 2001
author, Verbosio prototype XML Editor
author, JavaScript Developer's Dictionary
https://alexvincent.us/blog
Alex Vincent is offline   Reply With Quote
Old 08-06-2012, 10:10 PM   PM User | #3
alishag229
New to the CF scene

 
Join Date: Aug 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
alishag229 is an unknown quantity at this point
Quote:
Originally Posted by Alex Vincent View Post
Wild guess: does it pass if your XML code has no extraneous white space? (I doubt it, but it's worth a shot.)
hello, it didnt work
alishag229 is offline   Reply With Quote
Old 08-07-2012, 03:03 AM   PM User | #4
alishag229
New to the CF scene

 
Join Date: Aug 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
alishag229 is an unknown quantity at this point
Quote:
Originally Posted by qeuifang0 View Post
Can't help you if you don't give



if i dont give what?
alishag229 is offline   Reply With Quote
Reply

Bookmarks

Tags
validation, xml, xs schema, xsd

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:27 PM.


Advertisement
Log in to turn off these ads.