【发布时间】:2018-08-06 14:45:52
【问题描述】:
我有一个简短的问题,我到底在做什么错。我有我的 XML 和 DTD,无论我做什么,我都会遇到同样的错误。请帮忙。这是针对我已经多次更改此代码的课程,所以如果有任何遗漏,请随时告诉我。
这是我的 XML、sation 和 nameofshows,是我收到错误的地方...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tvlisting SYSTEM "tvlisting.dtd">
<tvlisting>
<changelocation>
<provider>Cox, ComCast, Charter, Dishnetwork, DirectTV</provider>
</changelocation>
<date>July 1, 2018</date>
<time>2:55pm</time>
<searchlisting>
<channelsearch>CBS, ABC, NBC, FOX, PBS, CW, MNT, ION, TELMUN, UNI, AandE,AMC,ANIMAL,
BBC,ETC.</channelsearch>
</searchlisting>
<tabs>pick by genre</tabs>
<legend>name and time show airs</legend>
<tableofshows>
<sation>AMC</sation>
<name>Limitless</name>
<timeaired>1:00pm-3:00pm</timeaired>
<sation>ANIMAL</sation>
<name>Extinct or Alive</name>
<timeaired>1:00pm-3:00pm</timeaired>
<sation>BBC</sation>
<name>Black Hawk Down</name>
<timeaired>1:00pm-4:00pm</timeaired>
<sation>BET</sation>
<name>Tyler Perry's Good Deeds</name>
<timeaired>1:00pm-3:00pm</timeaired>
<sation>BRAVO</sation>
<name>Kandi Koated Nighs</name>
<timeaired>2:30-3:00pm</timeaired>
</tableofshows>
<!-- sorry, the hour changed and some of the shows listed above are no longer on. -->
<showdetails>
<nameofshow>Black Hawk Down</nameofshow>
<information>An American mission to capture the top aides of a Somali warlord goes awry when
enemy forces shoot down two Black Hawk helicopters and surround the soldiers on the
ground. The ensuing firefight is a merciless 15-hour ordeal and the longest ground
battle involving American soldiers since the Vietnam War.</information>
<nameofshow>Tyler Perry's Good Deeds</nameofshow>
<information>Upstanding and engaged businessman Wesley (Tyler Perry) finds his upcoming
marriage thrown into question when his connection with a down-on-her-luck cleaning woman
turns unexpectedly romantic. </information>
</showdetails>
<filterforhd>
<options>1080p,720p,480p,standard</options>
</filterforhd>
</tvlisting>
这是我制作的 DTD,我的老师说这看起来完全没问题,但仍然感觉这缺少可以使它成为更好代码的东西。
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT tvlisting (changelocation+,date?,time?,searchlisting+,tabs*,legend?,tableofshows+,showdetails,filterforhd+) >
<!ELEMENT changelocation (provider?) >
<!ELEMENT provider (#PCDATA) >
<!ELEMENT date (#PCDATA) >
<!ELEMENT time (#PCDATA) >
<!ELEMENT searchlisting (channelsearch+) >
<!ELEMENT channelsearch (#PCDATA) >
<!ELEMENT tabs (#PCDATA) >
<!ELEMENT legend (#PCDATA) >
<!ELEMENT tableofshows (sation+, name+,timeaired+) >
<!ELEMENT sation (#PCDATA) >
<!ELEMENT name (#PCDATA) >
<!ELEMENT timeaired (#PCDATA) >
<!ELEMENT showdetails (nameofshow+, information+) >
<!ELEMENT nameofshow (#PCDATA) >
<!ELEMENT information (#PCDATA) >
<!ELEMENT filterforhd (options+) >
<!ELEMENT options (#PCDATA) >
【问题讨论】:
标签: xml xml-validation dtd