Connecting Tech Pros Worldwide Forums | Help | Site Map

entities in DTD

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,664
#1: Oct 3 '08
Hi,

I got a strange behaviour (FF 3) of entities in my xml files.

I have an element (see xml listing), where the attribute/content contains a latin1 entity (ö), but FF throws an error (entity not defined). the only workaround for that is to define the entities directly in the local xml DTD

anyone knows, how I can get the latin1 entities work in the external DTD?

thanks in advance

external DTD:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE kbl [
  2. // does not work
  3. <!ENTITY % HTMLlat1 PUBLIC
  4.    "-//W3C//ENTITIES Latin 1 for XHTML//EN"
  5.    "xhtml-lat1.ent">
  6. %HTMLlat1;
  7. // works
  8. <!ENTITY % relnavi SYSTEM "dtd.link.ent">
  9. %relnavi;
  10. <!ENTITY % dcmi SYSTEM "dtd.dublincore.ent">
  11. %dcmi;
  12.  
  13. <!ELEMENT kbl           (seite+)>
  14. <!ATTLIST kbl
  15.     xmlns               CDATA   #REQUIRED
  16.     xmlns:dcterms       CDATA   #IMPLIED
  17.     xmlns:link          CDATA   #IMPLIED
  18. >
  19.  
  20. <!-- further element declaration here -->
  21. ]>
xml file
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="iso-8859-1" ?>
  2. <!DOCTYPE kbl SYSTEM "struktur.dtd" [
  3. // workaround for latin1 entities
  4. <!ENTITY nbsp   " "> 
  5. <!ENTITY Auml   "Ä"> 
  6. <!ENTITY Ouml   "Ö"> 
  7. <!ENTITY Uuml   "Ü"> 
  8. <!ENTITY auml   "ä"> 
  9. <!ENTITY ouml   "ö"> 
  10. <!ENTITY uuml   "ü"> 
  11. <!ENTITY szlig   "ß">
  12. <!-- other latin1 entities -->
  13. ]>
  14. <kbl
  15.     xmlns="http://www.kulturbeutel-leipzig.net/XML/struktur"
  16.     xmlns:link="http://www.kulturbeutel-leipzig.net/XML/link"
  17.     xmlns:dcterms="http://purl.org/dc/terms/">
  18.  
  19. <!-- further elements here -->
  20. // here the "&ouml;" causes the problem
  21.     <link:author title="Sebastian B&ouml;hner">main.php?f=jeder#h06</link:author>
  22. </kbl>

drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,580
#2: Oct 3 '08

re: entities in DTD


This may be old (2006) but Firefox doesn't read external xml entities:
But they offer a solution.
Reply