Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4046924
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:37:33+00:00 2026-05-20T13:37:33+00:00

I have an XML that is associated with some XSD. I have included all

  • 0

I have an XML that is associated with some XSD. I have included all of the elements in the XML inside the XSD, including Root element. While validating the XML from this XSD, it’s saying that CAS (which’s the root element) is missing.

Anybody have an idea on how to solve this problem?

XML:

<?xml version="1.0"?>
<CAS xmlns="http://www.w3schools.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:schemaLocation="CASNamespace ..\..\CAS_backup.xsd">
    <name>CAS SD</name>
    <casBaseURL>www.sws.bfh.ch/studium/vorlesungen/</casBaseURL>
    <course id="C-jav">
    <name>Java</name>
    <teacher ref="T-joh"/>
    <lessons>40</lessons>
    <language>de</language>
    <language>en</language>
    <url>sd-java.xhtml</url>
    <weight>1.8</weight>
    </course>

    <course id="C-xml">
    <name>XML Technologien</name>
    <teacher ref="T-exe"/>
    <lessons>24</lessons>
    <project>8</project>
    <language>de</language>
    <language>en</language>
    <url>sd-xml.xhtml</url>
    <weight>1.6</weight>
    </course>

    <course id="C-rdb">
    <name>Relationale Datenbanken</name>
    <teacher ref="T-bas"/>
    <lessons>24</lessons>
    <project>8</project>
    <language>de</language>
    <language>en</language>
    <language>fr</language>
    <url>sd-rdb.xhtml</url>
    <weight>1.6</weight>
    </course>

   <course id="C-da">
   <name>Datenstrukturen und Algorithmen</name>
   <teacher ref="T-rit"/>
   <lessons>48</lessons>
   <language>de</language>
   <language>en</language>
   <url>sd-algodata.xhtml</url>
   <weight>1.8</weight>
   </course>

   <course id="C-gui">
   <name>GUI/Ergonomie</name>
   <teacher ref="T-joh"/>
   <teacher ref="T-nom"/>
   <lessons>24</lessons>
   <project>16</project>
   <language>de</language>
   <language>en</language>
   <url>sd-gui.xhtml</url>
   <weight>1.6</weight>
   </course>

   <student id="P-001">
       <name>
           <firstName>Roberto</firstName>
           <lastName>Campione</lastName>
       </name>
       <dateOfBirth>1970-12-12</dateOfBirth>
       <address>
           <street>
               <name>Bahnhofstrasse</name>
               <number>12</number>
               <addition>a</addition>
           </street>
           <postalCode>4000</postalCode>
           <city>Basel</city>
           <country>Schweiz</country>
       </address>
       <ratings>
           <rating ref="C-xml"><grade>85</grade></rating>
           <rating ref="C-da"><grade>82</grade></rating>
       </ratings>
   </student>
   <student id="P-002">
       <name>
           <firstName>Willis</firstName>
           <middleName>R.</middleName>
           <lastName>Pattern</lastName>
       </name>
       <dateOfBirth>1975-10-12</dateOfBirth>
       <address>
           <street>
               <name>Hauptstrasse</name>
               <number>10</number>
           </street>
           <postalCode>6000</postalCode>
           <city>Luzern</city>
           <country>Schweiz</country>
       </address>
       <ratings>
           <rating ref="C-da"><grade>45</grade></rating>
           <rating ref="C-xml"><grade>75</grade></rating>
           <rating ref="C-jav"><grade>75</grade></rating>
       </ratings>
   </student>
   <student id="P-003">
       <name>
           <firstName>Anna</firstName>
           <middleName>Maria</middleName>
           <lastName>Muster</lastName>
       </name>
       <dateOfBirth>1978-10-29</dateOfBirth>
       <address>
           <street>
               <name>Langstrasse</name>
               <number>8</number>
           </street>
           <postalCode>3000</postalCode>
           <city>Bern</city>
           <country>Schweiz</country>
       </address>
       <ratings>
           <rating ref="C-da"><grade>75</grade></rating>
           <rating ref="C-rdb"><grade>96</grade></rating>
           <rating ref="C-jav"><grade>88</grade></rating>
           <rating ref="C-gui"><grade>78</grade></rating>
       </ratings>
   </student>
   <student id="P-004">
       <name>
           <firstName>Hans</firstName>
           <middleName>Jochen</middleName>
           <lastName>Musterhans</lastName>
       </name>
       <dateOfBirth>1980-08-12</dateOfBirth>
       <address>
           <street>
               <name>Langgasse</name>
               <number>4</number>
           </street>
           <postalCode>8000</postalCode>
           <city>Winterthur</city>
           <country>Schweiz</country>
       </address>
       <ratings>
           <rating ref="C-da"><grade>95</grade></rating>
           <rating ref="C-rdb"><grade>92</grade></rating>
           <rating ref="C-jav"><grade>78</grade></rating>
           <rating ref="C-xml"><grade>76</grade></rating>
           <rating ref="C-gui"><grade>88</grade></rating>
       </ratings>
  </student>
  <student id="P-005">
      <name>
          <firstName>Christina</firstName>
          <lastName>Muster</lastName>
      </name>
      <dateOfBirth>1968-04-22</dateOfBirth>
      <address>
</CAS>

XSD:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet"  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="CASNamespace" xmlns="CASNamespace" xmlns:msdata="urn:schemas-    microsoft-com:xml-msdata"> 
    <xs:element name="CAS" type="CASType"/>
        <xs:complexType name="CASType">
            <xs:sequence>
                <xs:element ref="name"/>
                <!--<xs:element ref="casBaseURL"/>-->
                <xs:element maxOccurs="unbounded" ref="course"/>
                <xs:element maxOccurs="unbounded" ref="student"/>
                <xs:element maxOccurs="unbounded" ref="teacher"/>
                <!--<xs:element ref="courseParticipants"/>-->
            </xs:sequence>
        </xs:complexType>  

   <xs:element name="course">
       <xs:complexType>
           <xs:sequence>
               <xs:element name="name" type="xs:string" minOccurs="0"/>
               <xs:element name="lessons" type="xs:string" minOccurs="1" maxOccurs="50" />
               <xs:element name="project" type="xs:string" minOccurs="0"/>
               <xs:element name="url" minOccurs="1" maxOccurs="1">
           <xs:simpleType>
                   <xs:restriction base="xs:string">
                   <xs:pattern value="[a-zA-Z].*.xhtml"/>
                   </xs:restriction>
           </xs:simpleType>
       </xs:element>
               <xs:element name="weight" minOccurs="1">
                   <xs:simpleType>
                       <xs:restriction base="xs:float">             
                           <xs:pattern value="[0-9]\.[0-9]"/>
                       </xs:restriction>
                   </xs:simpleType>
               </xs:element>
               <xs:element ref="teacher" minOccurs="0" maxOccurs="unbounded" />
               <xs:element name="language" nillable="false" minOccurs="1" maxOccurs="4">
                   <xs:complexType>       
                       <xs:simpleContent msdata:ColumnName="language_Text" msdata:Ordinal="0">
                           <xs:extension base="xs:string" />
                       </xs:simpleContent>          
                   </xs:complexType>
               </xs:element>
               <xs:element ref="student" minOccurs="1" maxOccurs="unbounded" />
           </xs:sequence>
           <xs:attribute name="id">
               <xs:simpleType>
                   <xs:restriction base="xs:string">                
                       <xs:pattern value="[C]-[a-z][A-Z].*"/>
                   </xs:restriction>
               </xs:simpleType>
           </xs:attribute>
           <xs:attribute name="ref" type="xs:string" />
       </xs:complexType>
   </xs:element>

   <xs:element name="teacher">
       <xs:complexType>
           <xs:sequence>
               <xs:element ref="name" minOccurs="1" maxOccurs="unbounded" />
           </xs:sequence>
           <xs:attribute name="ref" type="xs:string" />
           <xs:attribute name="id">
               <xs:simpleType>
                   <xs:restriction base="xs:string">                
                       <xs:pattern value="[T]-[a-z][A-Z].*"/>
                   </xs:restriction>
               </xs:simpleType>
           </xs:attribute>
       </xs:complexType>
   </xs:element>

   <xs:element name="student">
       <xs:complexType>
           <xs:sequence>        
               <xs:element name="dateOfBirth" minOccurs="1" maxOccurs="1">
                   <xs:complexType>
                       <xs:sequence>
                           <xs:element name="Year">
                               <xs:simpleType>
                                   <xs:restriction base="xs:integer">
                                       <xs:minInclusive value="1920"/>
                                       <xs:maxInclusive value="2000"/>
                                   </xs:restriction>        
                               </xs:simpleType>
                           </xs:element>
                           <xs:element name="Month">
                               <xs:simpleType>
                                   <xs:restriction base="xs:integer">
                                       <xs:minInclusive value="1"/>
                                       <xs:maxInclusive value="12"/>
                                   </xs:restriction>        
                               </xs:simpleType>
                           </xs:element>
                           <xs:element name="Day">
                               <xs:simpleType>
                                   <xs:restriction base="xs:integer">
                                       <xs:minInclusive value="1"/>
                                       <xs:maxInclusive value="31"/>
                                   </xs:restriction>        
                               </xs:simpleType>
                           </xs:element>
                       </xs:sequence>
                   </xs:complexType>
               </xs:element>                
               <xs:element ref="name" minOccurs="1" maxOccurs="unbounded" />
               <xs:element name="address" minOccurs="0" maxOccurs="unbounded">
                   <xs:complexType>
                       <xs:sequence>
                           <xs:element name="postalCode" minOccurs="4" maxOccurs="5">
                               <xs:simpleType>
                                   <xs:restriction base="xs:string">
                                       <xs:pattern value="[0-9].*"/>
                                   </xs:restriction>
                               </xs:simpleType>
                           </xs:element>
                           <xs:element name="city" type="xs:string" minOccurs="0" />
                           <xs:element name="country" type="xs:string" minOccurs="0" />
                           <xs:element name="street" minOccurs="0" maxOccurs="unbounded">
                               <xs:complexType>
                                   <xs:sequence>
                                       <xs:element name="name" minOccurs="0">
                                           <xs:simpleType>
                                               <xs:restriction base="xs:string">
                                                   <xs:pattern value="[a-zA-Z].*"/>
                                               </xs:restriction>
                                           </xs:simpleType>
                                       </xs:element>
                                       <xs:element name="number" minOccurs="1">
                                           <xs:simpleType>
                                               <xs:restriction base="xs:string">
                                                   <xs:pattern value="[0-9].*"/>
                                               </xs:restriction>
                                           </xs:simpleType>
                                       </xs:element>
                                       <xs:element name="addition" type="xs:string" minOccurs="0" />
                                   </xs:sequence>
                               </xs:complexType>
                           </xs:element>
                       </xs:sequence>
                   </xs:complexType>
               </xs:element>
               <xs:element name="ratings" minOccurs="0" maxOccurs="unbounded">
                   <xs:complexType>
                       <xs:sequence>
                           <xs:element name="rating" minOccurs="0" maxOccurs="unbounded">
                               <xs:complexType>
                                   <xs:sequence>
                                       <xs:element name="grade" minOccurs="1" maxOccurs="1">
                                           <xs:simpleType>
                                               <xs:restriction base="xs:integer">
                                                   <xs:minInclusive value="1"/>
                                                   <xs:maxInclusive value="100"/>
                                               </xs:restriction>
                                           </xs:simpleType>
                                       </xs:element>
                                   </xs:sequence>
                                   <xs:attribute name="ref" type="xs:string" />
                               </xs:complexType>
                           </xs:element>
                       </xs:sequence>
                   </xs:complexType>
               </xs:element>
           </xs:sequence>
           <xs:attribute name="id">
               <xs:simpleType>
                   <xs:restriction base="xs:string">                
                       <xs:pattern value="[P]-[a-z][A-Z].*"/>
                   </xs:restriction>
               </xs:simpleType>
           </xs:attribute>
           <xs:attribute name="ref" type="xs:string" />
       </xs:complexType>
   </xs:element>

   <xs:element name="name">
       <xs:complexType>
           <xs:sequence>
               <xs:element name="firstName" minOccurs="1">
                   <xs:simpleType>
                       <xs:restriction base="xs:string">
                           <xs:pattern value="[a-z].*"/>
                       </xs:restriction>
                   </xs:simpleType>
               </xs:element>
               <xs:element name="middleName" minOccurs="1">
                   <xs:simpleType>
                       <xs:restriction base="xs:string">
                           <xs:pattern value="[a-z].*"/>
                       </xs:restriction>
                   </xs:simpleType>
               </xs:element>
               <xs:element name="lastName" minOccurs="1">
                   <xs:simpleType>
                       <xs:restriction base="xs:string">
                           <xs:pattern value="[a-z].*"/>
                       </xs:restriction>
                   </xs:simpleType>
               </xs:element>
           </xs:sequence>
       </xs:complexType>
   </xs:element>  
</xs:schema>

Regards,

Usman

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:37:33+00:00Added an answer on May 20, 2026 at 1:37 pm

    Your Xml document specifies xmlns="http://www.w3schools.com" as its default namespace whereas your schema specifies targetNamespace="CASNamespace" xmlns="CASNamespace" as the target namespace.

    Change xmlns="http://www.w3schools.com" in your Xml document to xmlns="CASNamespace" and your document will … still not validate because it complains that it expects element <course/> instead of <casBaseURL />.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some XML that is structured like this: <whatson> <productions> <production> <category>Film</category> </production>
I have a xml that has so many elements and most of that contain
I have an xml that comes in two forms <root> <element1 req=mandatory/> <element2/> <element3/>
I have some XML that I want to parse using the lxml method in
I have an XML document and associated schema that defines several attributes as having
I have some code that is using the following xml file. Can someone tell
I have XML that looks like this: <Parameter Name=parameter name Value=parameter value /> which
I have XML that looks like this: <ROW ref=0005631 type=04 line=1 value=Australia/> <ROW ref=0005631
I have XML tag that has the content which is HTML document. <xml-tag> <!--
I have an XML that goes like this: <?xml version=1.0 encoding=utf-8 ?> <colors> <color

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.