0

I've just made a xml with xsd and it returns errors (after doing xmllint) but I don't know what I've done wrong
please help

<?xml version="1.0"?>

<theatre xmlns="file:///students/u4722839/2012_Sem_2/comp3410/practice/theatre"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="file:///students/u4722839/2012_Sem_2/comp3410/practice/theatre/theatre.xsd">

    <movie>

        <title> Dark Knight </title>
        <genre> Thriller </genre>
        <director> Christopher Nolan </director>
        <rating> PG </rating>
        <time> 2 hours </time>

    </movie>    

    <movie>

        <title> Pasong Egg Tak </title>
        <genre> Comedy </genre>
        <director> Lim Chang Jung </director>
        <rating> PG </rating>
        <time> 1 hours and 30 minutes </time>

    </movie>    

    <movie>

        <title> Malaton </title>
        <genre> Documentary </genre>
        <director> Song Chang Shik </director>
        <rating> PG </rating>
        <time> 2 hours </time>

    </movie>    


    <movie>

        <title> Comedy Man </title>
        <genre> Comedy </genre>
        <director> Alex Bruce </director>
        <rating> PG </rating>
        <time> 2 hours </time>

    </movie>    


</theatre>

my Schema

<?xml version="1.0"?>
<xs:schema xmlns="http://www.w3.org/2001/XMLSchema"
       xmlns:payroll="file:///students/u4722839/2012_Sem_2/comp3410/practice/theatre"
       targetNamespace="file:///students/u4722839/2012_Sem_2/comp3410/practice/theatre"
       elementFormDefault="qualified">

<xs:element name="theatre" type="theatreType" />

    <xs:complexType name="theatreType">

        <xs:sequence>

            <xs:element name="movie" type="movieType" 
             minOccurs="1" maxOccurs="unbounded"/>

        </xs:sequence>

    </xs:complexType>

<xs:complexType name="movieType">

    <xs:sequence>

        <xs:element name="title" type="xs:string" />
        <xs:element name="genre" type="xs:string" />
        <xs:element name="director" type="xs:string" />
        <xs:element name="rating" type="xs:string" />
        <xs:element name="time" type="xs:string" />

    </xs:sequence>

</xs:complexType>

</xs:schema>

The error

theatre.xsd:5: namespace error : Namespace prefix xs on schema is not defined
       elementFormDefault="qualified">
                                     ^
theatre.xsd:7: namespace error : Namespace prefix xs on element is not defined
<xs:element name="theatre" type="theatreType" />
                                              ^
theatre.xsd:9: namespace error : Namespace prefix xs on complexType is not defined
    <xs:complexType name="theatreType">
                                      ^
theatre.xsd:11: namespace error : Namespace prefix xs on sequence is not defined
        <xs:sequence>
                    ^
theatre.xsd:14: namespace error : Namespace prefix xs on element is not defined
             minOccurs="1" maxOccurs="unbounded"/>
                                                ^
theatre.xsd:20: namespace error : Namespace prefix xs on complexType is not defined
<xs:complexType name="movieType">
                                ^
theatre.xsd:22: namespace error : Namespace prefix xs on sequence is not defined
    <xs:sequence>
                ^
theatre.xsd:24: namespace error : Namespace prefix xs on element is not defined
        <xs:element name="title" type="xs:string" />
                                                  ^
theatre.xsd:25: namespace error : Namespace prefix xs on element is not defined
        <xs:element name="genre" type="xs:string" />
                                                  ^
theatre.xsd:26: namespace error : Namespace prefix xs on element is not defined
        <xs:element name="director" type="xs:string" />
                                                     ^
theatre.xsd:27: namespace error : Namespace prefix xs on element is not defined
        <xs:element name="rating" type="xs:string" />
                                                   ^
theatre.xsd:28: namespace error : Namespace prefix xs on element is not defined
        <xs:element name="time" type="xs:string" />
2
Contributors
1
Reply
6
Views
5 Years
Discussion Span
Last Post by Mike Askew
0

In your XSD...

change all the xs: to xsl:

and add a reference to xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

Your missing that reference and so its saying your referencing a prefix xs which does not exist anywhere. The above is a general reference that I have in ALL of my XSLT files.

Edited by Mike Askew

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.