0

I'm new to writing XML and Schemas. I am writing an XML document that can be validated by a schema. When I run the XML document, I get this error:

This page contains the following errors: error on line 41 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error.

XML Document:

<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type='text/css' href='schoolschedulecss.css'?>
<!-- Schema code -->
<xs:schema
  elementFormDefault="qualified"
  attributeFormDefault="unqualified"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="student-schedule">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="semester" minOccurs="2" maxOccurs="2">
          <xs:complexType>
            <xs:all>
              <xs:element name="term" type="xs:string"/>
              <xs:element name="course" minOccurs="3" maxOccurs="3">
                <xs:complexType>
                  <xs:all>
                    <xs:element name="cTitle" type="xs:string"/>
                    <xs:element name="professor" type="xs:string"/>
                    <xs:element name="dates" type="xs:string"/>
                    <xs:element name="days" type="xs:string"/>
                    <xs:element name="times" type="xs:string"/>
                    <xs:element name="room" type="xs:string"/>
                  </xs:all>
                  <xs:attribute name="code" type="xs:string"/>
                </xs:complexType>
              </xs:element>
            </xs:all>
            <xs:attribute name="season" type="xs:string"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
<!--

-->
<student-schedule>
  <semester season="Fall">
    <term>Fall 2023-2024</term>
    <course code="ART240">
      <cTitle>Interior Design</cTitle>
      <professor>Ann May</professor>
      <dates>05/22/2023 - 07/23/2023</dates>
      <days>Days: To be Announced</days>
      <times>Times: To be Announced</times>
      <room>Online</room>
    </course>
    <course code="HIST120">
      <cTitle>Art History</cTitle>
      <professor>Dom Darrell</professor>
      <dates>05/22/2023 - 07/23/2023</dates>
      <days>Days: Monday, Wednesday</days>
      <times>Times: 8:00AM - 9:00AM</times>
      <room>B120</room>
    </course>
    <course code="ART205">
      <cTitle>Introduction to Digital Design</cTitle>
      <professor>Frank Howard</professor>
      <dates>05/22/2023 - 07/23/2023</dates>
      <days>Days: To be Announced</days>
      <times>Times: To be Announced</times>
      <room>Online</room>
    </course>
  </semester>
  <semester season="Spring">
    <term>Spring 2023-2024</term>
    <course code="BUS120">
      <cTitle>Entrepreneurship</cTitle>
      <professor>Henri Lysol</professor>
      <dates>01/22/2024 - 05/23/2024</dates>
      <days>Days: Tuesday, Thursday</days>
      <times>Times: 9:00AM - 12:00PM</times>
      <room>Online</room>
    </course>
    <course code="ART305">
      <cTitle>Intermediate Digital Design</cTitle>
      <professor>Frank Howard</professor>
      <dates>01/22/2024 - 05/23/2024</dates>
      <days>Days: Monday, Wednesday</days>
      <times>Times: 8:00AM - 9:00AM</times>
      <room>A120</room>
    </course>
    <course code="ART207">
      <cTitle>Introduction to 3D Art</cTitle>
      <professor>Frank Howard</professor>
      <dates>01/22/2024 - 05/23/2024</dates>
      <days>Days: Wednesday</days>
      <times>Times: 10:00AM - 4:00PM</times>
      <room>A105</room>
    </course>
  </semester>
</student-schedule>

CSS:


student-schedule {
  display: grid;
  row-gap: 40px;
}

semester {
  display: table;
  width: 100%;
  border-spacing:10px;
  border: 2px solid green;
}
course{
  display: table-row;
}
professor, dates, days, times, room{
  display: table-cell;

}

The XML document loaded without errors and looked as it was supposed to before I entered the schema, but I am not sure what I am doing wrong exactly. I did get this error before, but I resolved it by closing some of the tags (I accidently put the / in the wrong place). Now, I am not sure what the issue is.

AK123
  • 1
  • Is it about CSS, or about XML Schema validation? – Yitzhak Khabinsky Jul 06 '23 at 00:07
  • An XML document must have a single root element. For example, you cannot append an XSD and an XML document in the same file. See the duplicate link for other causes of this sort of error. – kjhughes Jul 06 '23 at 00:16

0 Answers0