I'm using a seperate .dtd file as a doctype for my custom xml file:
names.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE name SYSTEM "names.dtd">
<names>
<name>
<text>Pepé</text>
<creator>&lost;</creator>
<history>&lost;</history>
</name>
<name>
<text>Charles</text>
<creator>James</creator>
<history>&lost;</history>
</name>
</names>
names.dtd
<!ELEMENT name (text, creator+, history)>
<!ELEMENT text (#PCDATA)>
<!ELEMENT creator (#PCDATA)>
<!ELEMENT history (#PCDATA)>
<!-- Placeholder/unknown history or creator name -->
<!ENTITY lost "Lost in the depths of time.">
<!ENTITY eacute "é">
However when trying to access names.xml I get the following error:
XML Parsing Error: undefined entity Location: http://localhost/.../names.xml Line Number 5, Column 18:
<text>Pepé</text>
---------^
Just for clarification names.xml and names.dtd are in the same directory and using http://localhost/.../names.dtd doesn't work either.
This does seem to work when putting the <!ENTITY
inside a <!DOCTYPE
in names.xml
however. Can anyone advise on this?