我知道这听起来像是一个很常见的问题,但我搜索了整个堆栈溢出并找不到任何东西。我现在遇到的问题是顶部的 xml 元素“学生”不会从 css 中获得背景颜色。我有正确嵌套的 xml 和所有内容,并且我在我的 css 文件中正确拼写了 XML 元素。我尝试了一个 xml 验证器,并且该文档似乎格式正确。那么可能有什么问题呢?
这是XML
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="stylexml.css"?>
<Registration>
<Student>
<Id>0001234567</Id>
<University>Indiana University Purdue University Indianapolis</University>
<Education>Undergraduate</Education>
<Category>Technology Undergraduate</Category>
<Degree>Computer Tech BS</Degree>
</Student>
<Semester>
<Season>Spring Semester</Season>
<Year>2004-2005</Year>
<Bterm>Senior</Bterm>
<Eterm>Senior</Eterm>
</Semester>
<Class id="0">
<Course>CIT 412</Course>
<Number>12981</Number>
<Section>0100</Section>
<Description>XML-BASED WEB APPLICATIONS</Description>
<Component>Lecture</Component>
<Grading>Graded</Grading>
<Grade> </Grade>
<Units>3.00</Units>
<Status>Enrolled</Status>
<!--New instance of schedule only created if time or location differs on weekdays-->
<Schedule id="0">
<Start>1:00PM</Start>
<End>2:15PM</End>
<Weekday>Mon,Wed</Weekday>
<Location>SL SL223</Location>
</Schedule>
<Instructor>Fernandez, Eugenia</Instructor>
</Class>
<Class id="1">
<Course>CIT 479</Course>
<Number>12988</Number>
<Section>0100</Section>
<Description>DATABASE IMPLEMENTATN & ADMIN</Description>
<Component>Lecture</Component>
<Grading>Graded</Grading>
<Grade> </Grade>
<Units>3.00</Units>
<Status>Enrolled</Status>
<Schedule id="0">
<Start>7:15PM</Start>
<End>8:30PM</End>
<Weekday>Mon</Weekday>
<Location>SL SL223</Location>
</Schedule>
<Schedule id="1">
<Start>7:15PM</Start>
<End>8:30PM</End>
<Weekday>Wed</Weekday>
<Location>SL SL216</Location>
</Schedule>
<Instructor> </Instructor>
</Class>
<Class id="2">
<Course>MATH M-119</Course>
<Number>15304</Number>
<Section>0400</Section>
<Description>BRIEF SURVEY OF CALCULUS 1</Description>
<Component>Lecture</Component>
<Grading>Graded</Grading>
<Grade> </Grade>
<Units>3.00</Units>
<Status>Enrolled</Status>
<Schedule id="0">
<Start>5:45PM</Start>
<End>7:15PM</End>
<Weekday>Mon,Wed</Weekday>
<Location>LE 104</Location>
</Schedule>
<Instructor>Tam,Richard Yiu-Hang</Instructor>
</Class>
</Registration>
这是CSS:
@charset "utf-8";
/* CSS Document */
Registration
{
font-family:"MS Serif", "New York", serif;
font-size:16px;
font-style:normal;
top:0px;
bottom:0px;
}
Student
{
background-color:red;
}
Id,University,Education,Category,Degree
{
display:block;
//background-color:blue;
}
Semester
{
background-color:yellow;
border-bottom-style:ridge;
}
Class
{
margin-top:20px;
border-style:solid;
display:block;
background-color:cyan;
}
Course
{
font-weight:bolder;
}
Description, Component
{
display:block;
}
Schedule
{
display:block;
}