Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,460
    Thanks
    1
    Thanked 23 Times in 21 Posts
    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

  • #3
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by qeuifang0 View Post
    Can't help you if you don't give



    if i dont give what?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •