I have been banging my head over this simple problem for hours and can't find anything on the internet that helps...
The entity substitution will not work unless it is defined in the Main XML file. I tried putting it in the SimpleExternalDTD2.dtd and in another MyEntities.dtd file, but neither work. It used to work until I added the parameter entity. Adding that broke the general entity substitution. What am I doing wrong?
Main XML file using external general entity:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE doc SYSTEM "SimpleExternalDTD2.dtd">
<doc xmlns=" <greeting>
Hello &me;!
</greeting>
<message>
<title>Using ENTITYs</title>
<body>Are we having fun yet?</body>
</message>
</doc>
SimpleExternalDTD2.dtd:
<!ENTITY % names SYSTEM "MyEntities.dtd">
<!ELEMENT doc(greeting, message)>
<!ATTLIST doc xmlns CDATA #FIXED "<!ENTITY % record "(title, body)">
<!ELEMENT greeting (#PCDATA)>
<!ELEMENT message %record;>
<!ELEMENT title (#PCDATA)>
<!ELEMENT body (#PCDATA)>
%names;
MyEntities.dtd:
<!ENTITY me "Mr. Mystery Guy">
The entity substitution will not work unless it is defined in the Main XML file. I tried putting it in the SimpleExternalDTD2.dtd and in another MyEntities.dtd file, but neither work. It used to work until I added the parameter entity. Adding that broke the general entity substitution. What am I doing wrong?
Main XML file using external general entity:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE doc SYSTEM "SimpleExternalDTD2.dtd">
<doc xmlns=" <greeting>
Hello &me;!
</greeting>
<message>
<title>Using ENTITYs</title>
<body>Are we having fun yet?</body>
</message>
</doc>
SimpleExternalDTD2.dtd:
<!ENTITY % names SYSTEM "MyEntities.dtd">
<!ELEMENT doc(greeting, message)>
<!ATTLIST doc xmlns CDATA #FIXED "<!ENTITY % record "(title, body)">
<!ELEMENT greeting (#PCDATA)>
<!ELEMENT message %record;>
<!ELEMENT title (#PCDATA)>
<!ELEMENT body (#PCDATA)>
%names;
MyEntities.dtd:
<!ENTITY me "Mr. Mystery Guy">