简体   繁体   中英

PEReference error with XML external ENTITY DTD

I have this XML code declaring an external DTD ENTITY:

<!DOCTYPE customers [
 <!ENTITY % itemCodes SYSTEM "codes.dtd">
 %itemCodes;
]>

This is simply to call up some pre-written codes from codes.dtd :

<!ENTITY DCT5Z "Tapan Digital Camera 5 Mpx - zoom">
<!ENTITY SM128 "SmartMedia 128MB Card">
<!-- etc. -->

But I get this error:

This page contains the following errors:

error on line 53 at column 8: PEReference: %itemCodes; not found

Why would that be?

Why would that be?

Because it can't find the codes.dtd file. If you aren't using some sort of catalog based resolution mechanism, then the codes.dtd would have to be in the working directory of the program you're running.

But an error on line 53 seems odd. That's too far into a file for a DTD. What does line 53 look like?

UPDATE : On reconsideration, the problem may not be that codes.dtd couldn't be found, but that the XML parser being used doesn't process external entities. (After all, it said that the PE reference itself, and not its referent, couldn't be found.) This is a quite common limitation of non-validating parsers, but the error diagnostic could have been more helpful ("Sorry, external entity references are not supported".)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM