好的,对于一直在跟踪此问题的人:感谢您的耐心和帮助。我完全重做这个问题,希望能够提供答案,见解,甚至只是一个理论。为了呈现我的XML代码,我将其简化为仅重现问题所需的元素。
正如我在原始帖子中所解释的那样,XML文件用于在学期>课程>单元>文本层次结构中存储学术课程的数据。这是一个最小的例子:
<MLIS>
<semester>
<semesterInfo>
<semNumber>1</semNumber>
<season>Spring</season>
<semYear>2014</semYear>
</semesterInfo>
<courses>
<course>
<courseInfo>
<department>IRLS</department>
<courseNumber>504</courseNumber>
<courseTitleInfo>
<courseTitle>Foundations</courseTitle>
</courseTitleInfo>
</courseInfo>
<units>
<unit>
<unitInfo>
<unitNumber>1</unitNumber>
<unitTitle>Introductions</unitTitle>
</unitInfo>
<unitMaterial>
<resource>
<type>video lecture</type>
<titleInfo>
<title>Pre-course lecture</title>
</titleInfo>
<authorInfo>
<author>
<firstName>Joe</firstName>
<lastName>Blow</lastName>
<displayForm>Blow</displayForm>
</author>
</authorInfo>
<dateInfo>
<dateIssued>Aug 13, 2013</dateIssued>
</dateInfo>
<extent>
<time>
<minutes>14</minutes>
<seconds>17</seconds>
</time>
</extent>
<competency>
<comp>n/a</comp>
</competency>
<link></link>
</resource>
</unitMaterial>
</unit>
</units>
</course>
<course>
<courseInfo>
<department>IRLS</department>
<courseNumber>515</courseNumber>
<courseTitleInfo>
<courseTitle>Org ofInfo</courseTitle>
</courseTitleInfo>
</courseInfo>
<units>
<unit>
<unitInfo>
<unitNumber>1</unitNumber>
<unitTitle>Course Overview</unitTitle>
</unitInfo>
<unitMaterial>
<resource>
<type>book chapter</type>
<titleInfo>
<title>Org of Recorded Inf</title>
</titleInfo>
<authorInfo>
<author>
<firstName>Arlene G.</firstName>
<lastName>Taylor</lastName>
</author>
<author>
<firstName>Daniel</firstName>
<lastName>Joudrey</lastName>
</author>
</authorInfo>
<dateInfo>
<dateIssued>2008</dateIssued>
</dateInfo>
<extent>
<pages>
<numberPgs>33</numberPgs>
</pages>
</extent>
<hostWork>
<book>
<titleInfo>
<title>The Org ofInfo</title>
<subTitle>3rd Ed</subTitle>
</titleInfo>
<author>
<firstName>Arlene</firstName>
<lastName>Taylor</lastName>
</author>
<originInfo>
<publisher>LibUnl</publisher>
<place>Westport, Conn</place>
</originInfo>
</book>
</hostWork>
<competency>
<comp>n/a</comp>
</competency>
</resource>
</unitMaterial>
</unit>
</units>
</course>
</courses>
</semester>
<semester>
<semesterInfo>
<semNumber>2</semNumber>
<season>Summer</season>
<semYear>2014</semYear>
</semesterInfo>
<courses>
<course>
<courseInfo>
<department>IRLS</department>
<courseNumber>540</courseNumber>
<courseTitleInfo>
<courseTitle>Intro to Archives</courseTitle>
</courseTitleInfo>
</courseInfo>
<units>
<unit>
<unitInfo>
<unitNumber>1</unitNumber>
<unitTitle>History and Theory</unitTitle>
</unitInfo>
<unitMaterial>
<resource>
<type>book chapter</type>
<titleInfo>
<title>Metadata: Description</title>
</titleInfo>
<authorInfo>
<author>
<firstName>Arlene G.</firstName>
<lastName>Taylor</lastName>
</author>
<author>
<firstName>Daniel N.</firstName>
<lastName>Joudrey</lastName>
</author>
</authorInfo>
<dateInfo>
<dateIssued>2008</dateIssued>
</dateInfo>
<extent>
<pages>
<numberPgs>45</numberPgs>
</pages>
</extent>
<hostWork>
<book>
<titleInfo>
<title>The Org of Inf</title>
<subTitle>Third Ed</subTitle>
</titleInfo>
<author>
<firstName>Arlene</firstName>
<lastName>Taylor</lastName>
</author>
<originInfo>
<publisher>Lib Unl</publisher>
<place>Westport, Conn</place>
</originInfo>
</book>
</hostWork>
<competency>
<comp>n/a</comp>
</competency>
</resource>
</unitMaterial>
</unit>
</units>
</course>
</courses>
</semester>
</MLIS>
我在星期五之前得到的是一个HTML页面,它显示每个学期,每个课程,每个课程中的所有单元,以及每个单元内的所有文本(资源)。我使用jQuery toggle()在每个级别显示和隐藏。
现在页面只显示第一个学期。循环不再拿到第二学期,我不知道为什么。我真的很想解决这个问题。