2
我有一個XML文件,我試圖根據DTD進行驗證(在與XML相同的本地文件夾中)。 XML檢出格式良好,但每次嘗試在記事本++中對DTD進行驗證都會導致「無法加載DTD PresidentsDTD.dtd」錯誤。任何想法我需要做些什麼來得到這個工作?記事本++根據本地DTD驗證XML
XML文件:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE LIST SYSTEM "PresidentsDTD.dtd">
<LIST>
<PRESIDENT id="01" gender="male" name="GeorgeWashington">
<NAME>
<FIRST>George</FIRST>
<MIDDLE />
<LAST>Washington</LAST>
</NAME>
<TERM count="2">
<TERMSTART>1789</TERMSTART>
<TERMEND>1797</TERMEND>
<TERML unit="years"> 8 </TERML>
</TERM>
<PARTY>N/A</PARTY>
<HOMESTATE>Virginia</HOMESTATE>
</PRESIDENT>
<PRESIDENT id="02" gender="male" name="JohnAdams">
<NAME>
<FIRST>John</FIRST>
<MIDDLE />
<LAST>Adams</LAST>
</NAME>
<TERM count="2">
<TERMSTART>1797</TERMSTART>
<TERMEND>1801</TERMEND>
<TERML unit="years"> 8 </TERML>
</TERM>
<PARTY>Federalist</PARTY>
<HOMESTATE>Massachusetts</HOMESTATE>
</PRESIDENT>
<PRESIDENT id="03" gender="male" name="ThomasJefferson">
<NAME>
<FIRST>Thomas</FIRST>
<MIDDLE />
<LAST>Jefferson</LAST>
</NAME>
<TERM count="2">
<TERMSTART>1801</TERMSTART>
<TERMEND>1809</TERMEND>
<TERML unit="years"> 8 </TERML>
</TERM>
<PARTY>Republican-Democrat</PARTY>
<HOMESTATE>Virginia</HOMESTATE>
</PRESIDENT>
<PRESIDENT id="07" gender="male" name="AndrewJackson">
<NAME>
<FIRST>Andrew</FIRST>
<MIDDLE />
<LAST>Jackson</LAST>
</NAME>
<TERM count="2">
<TERMSTART>1829</TERMSTART>
<TERMEND>1837</TERMEND>
<TERML unit="years"> 8 </TERML>
</TERM>
<PARTY>Democrat</PARTY>
<HOMESTATE>Tennesee</HOMESTATE>
</PRESIDENT>
<PRESIDENT id="09" gender="male" name="WilliamHenryHarrison">
<NAME>
<FIRST>William</FIRST>
<MIDDLE>Henry</MIDDLE>
<LAST>Harrison</LAST>
</NAME>
<TERM count="1">
<TERMSTART>1841</TERMSTART>
<TERMEND>1841</TERMEND>
<TERML unit="months"> 1 </TERML>
</TERM>
<PARTY>Whig</PARTY>
<HOMESTATE>Ohio</HOMESTATE>
</PRESIDENT>
<PRESIDENT id="15" gender="male" name="AbrahamLincoln">
<NAME>
<FIRST>Abraham</FIRST>
<MIDDLE />
<LAST>Lincoln</LAST>
</NAME>
<TERM count="2">
<TERMSTART>1861</TERMSTART>
<TERMEND>1865</TERMEND>
<TERML unit="years"> 4 </TERML>
</TERM>
<PARTY>Republican</PARTY>
<HOMESTATE>Illinois</HOMESTATE>
</PRESIDENT>
</LIST>
我PresidentsDTD.dtd文件(在第2行還是返回一個錯誤出於某種原因):
<!DOCTYPE LIST[
<!ELEMENT LIST PRESIDENT+>
<!ELEMENT PRESIDENT (NAME, TERM, PARTY, HOMESTATE)>
<!ATTLIST PRESIDENT id ID #REQUIRED>
<!ATTLIST PRESIDENT gender (male | female) #IMPLIED>
<!ATTLIST PRESIDENT name CDATA #IMPLIED>
<!ELEMENT NAME (FIRST, MIDDLE?, LAST)>
<!ELEMENT TERM (TERMSTART, TERMEND, TERMLENGTH)>
<!ATTLIST TERM count CDATA #IMPLIED>
<!ELEMENT FIRST (#PCDATA)>
<!ELEMENT MIDDLE (#PCDATA)>
<!ELEMENT LAST (#PCDATA)>
<!ELEMENT TERMSTART (#PCDATA)>
<!ELEMENT TERMEND (#PCDATA)>
<!ELEMENT TERMLENGTH (#PCDATA)>
<!ATTLIST TERMLENGTH unit (months | years) #IMPLIED>
]>
沒有人有驗證針對DTD本地的解決方案?