CC: | <tabmcleo [...] cs.ubc.ca> |
Subject: | Bug in XML::Simple::DTDReader (0.04) when reading XML files with an external DTD |
Date: | Tue, 20 Oct 2009 15:18:36 -0700 |
To: | <bug-XML-Simple-DTDReader [...] rt.cpan.org> |
From: | "Trevor McLeod" <tabmcleo [...] cs.ubc.ca> |
Hello,
I am encountering a problem with a Perl program trying to read in an XML
file with an external DTD. The error message, generated by DTDReader is as
follows:
"Your DTD claimed the root element would be 'metadata', but failed to define
that element type. at /opt/urlmd_test/urlmd line 450" where "urlmd" is my
Perl program.
If I include the DTD inline with the XML file, DTDReader parses the XML file
correctly. I have doubled check both my XML file and DTD file with a
validator and they appear correct:
XML:
1 <?xml version="1.0"?>
2 <!DOCTYPE metadata SYSTEM "metadata.dtd">
3 <metadata>
4 <acm_ccs>asdfasdf</acm_ccs>
5 <author>Trevor McLeod</author>
6 <author>Mike Brannigan</author>
7 <author>Ted Bessel</author>
8 <datatype>dt1</datatype>
9 <datatype>dt2</datatype>
10 <faculty_member>Dr. Beverly Crusher</faculty_member>
11 <keyword>kw1</keyword>
12 <keyword>kw2</keyword>
13 <lab>SPL</lab>
14 <pages>45</pages>
15 <publication_venue>UBC</publication_venue>
16 <research_topic>Some research topic</research_topic>
17 <title>Some title</title>
18 <year>2010</year>
19 </metadata>
DTD:
1 <!ELEMENT metadata (acm_ccs?, author*, datatype*, faculty_member?,
keyword*, lab?, pages?, publication_venue?, research_topic?, title?, year?)>
2 <!ELEMENT acm_ccs (#PCDATA)>
3 <!ELEMENT author (#PCDATA)>
4 <!ELEMENT datatype (#PCDATA)>
5 <!ELEMENT faculty_member (#PCDATA)>
6 <!ELEMENT keyword (#PCDATA)>
7 <!ELEMENT lab (#PCDATA)>
8 <!ELEMENT pages (#PCDATA)>
9 <!ELEMENT publication_venue (#PCDATA)>
10 <!ELEMENT research_topic (#PCDATA)>
11 <!ELEMENT title (#PCDATA)>
12 <!ELEMENT year (#PCDATA)>
I am using Perl 5.10.0 on SuSE Linux 11.1 (Linux lillooet.cs.ubc.ca
2.6.27.29-0.1-pae #1 SMP 2009-08-15 17:53:59 +0200 i686 i686 i386
GNU/Linux).
Sincerely,
Trevor McLeod
Systems Analyst
UBC, Department of Computer Science
X463-2366 Main Mall
Vancouver, B.C. Canada V6T 1Z4
Phone: +1 604 822-8285