RoyT Posted September 23, 2011 Share Posted September 23, 2011 It appears that browsers will process internal DTDs but will not read them in a separate file. Please clarify what is going on here. The css is read and processed just fine. The important problem for me is the failure to recognize the ENTITY definition. I appreciate any help. person.dtd=========<!ELEMENT person (first_name, profession)<!ELEMENT first_name (#PCDATA)<!ELEMENT profession (#PCDATA)<!ENTITY ndash "–">person.css=========first_name{ display: block; font-family: "Times New Roman", serif; font-weight: bold; font-size: 10pt;}profession{ display: block; font-family: "Times New Roman", serif; font-style: italic; font-size: 10pt;}person.xml=========<?xml version="1.0"?><?xml-stylesheet type="text/css" href="person.css"?><!-- the following does not work --><!DOCTYPE person SYSTEM "person.dtd"><!-- the following works --><!--<!DOCTYPE person [ <!ENTITY ndash "–">]>--><person> <name> <first_name>Alan</first_name> </name> <profession>computer–scientist</profession></person> Link to comment Share on other sites More sharing options...
Ingolme Posted September 23, 2011 Share Posted September 23, 2011 You have the syntax wrong in your DTD file. You're missing closing angle brackets: <!ELEMENT person (first_name, profession)><!ELEMENT first_name (#PCDATA)><!ELEMENT profession (#PCDATA)><!ENTITY ndash "–"> Link to comment Share on other sites More sharing options...
RoyT Posted September 23, 2011 Author Share Posted September 23, 2011 Thank you for looking at this, but that fix did not change the failure: XML Parsing Error: undefined entityLocation: file:///home/rtouzeau/Documents/Calendar-Sheets/CSS-Play/person.xmlLine Number 17, Column 23: <profession>computer–scientist</profession>----------------------^ I have spent a LOT of time looking at ref manuals and twisting this code every way I could think of. Link to comment Share on other sites More sharing options...
Ingolme Posted September 23, 2011 Share Posted September 23, 2011 Can you post your updated DTD and XML file? When I test the code you provided, it works just fine. You don't seem to be using your entity anywhere. Link to comment Share on other sites More sharing options...
RoyT Posted September 23, 2011 Author Share Posted September 23, 2011 Sure just a sec. Like I said, I have twisted this code a lot trying to get it to work. The – appears to have been replaced somewhere by my cut/paste or somewhere else. It was/is between "computer" and "scientist". Link to comment Share on other sites More sharing options...
RoyT Posted September 23, 2011 Author Share Posted September 23, 2011 Ok, here we go. The – shows up now. First is "person.dtd" and following is "person.xml" <!ELEMENT person (first_name, profession)><!ELEMENT first_name (#PCDATA)><!ELEMENT profession (#PCDATA)><!ENTITY ndash "–"><?xml version="1.0"?><?xml-stylesheet type="text/css" href="person.css"?><!-- the following does not work --><!DOCTYPE person SYSTEM "person.dtd"><!-- the following works --><!--<!DOCTYPE person [ <!ENTITY ndash "–">]>--><person> <name> <first_name>Alan</first_name> </name> <profession>computer–scientist</profession></person> Link to comment Share on other sites More sharing options...
RoyT Posted September 23, 2011 Author Share Posted September 23, 2011 Ok, I see now. The – is being converted to - in the posting process. Please replace in your copy. Link to comment Share on other sites More sharing options...
RoyT Posted September 23, 2011 Author Share Posted September 23, 2011 Let me try this...<?xml version="1.0"?><?xml-stylesheet type="text/css" href="person.css"?><!-- the following does not work --><!DOCTYPE person SYSTEM "person.dtd"><!-- the following works --><!--<!DOCTYPE person [ <!ENTITY ndash "–">]>--><person> <name> <first_name>Alan</first_name> </name> <profession>computer–scientist</profession></person> Link to comment Share on other sites More sharing options...
RoyT Posted September 23, 2011 Author Share Posted September 23, 2011 Sorry for the multiple tries... <person> <name> <first_name>Alan</first_name> </name> <profession>computer–scientist</profession></person> Link to comment Share on other sites More sharing options...
RoyT Posted September 23, 2011 Author Share Posted September 23, 2011 Sorry, even using "code" doesn't leave the darn thing alone. I give up! Link to comment Share on other sites More sharing options...
Ingolme Posted September 23, 2011 Share Posted September 23, 2011 I'm just testing now on my computer. It's not working for me either, though it should in theory. The only conclusion I get is that the doctype isn't loading the DTD file for some reason. Link to comment Share on other sites More sharing options...
Ingolme Posted September 23, 2011 Share Posted September 23, 2011 I just got this from the Mozilla Developer Network: Mozilla does not load external entities from the web. Mozilla can load external entities whose system identifier uses the chrome protocol. This feature is used mainly to localize Mozilla to different languages (the UI strings are stored in external DTD files). Another exception is an entity whose system identifier is a relative path, and the XML declaration states that the document is not standalone (default), in which case Mozilla will try to look for the entity under <bin>/res/dtd directory.It means that you have to declare your entities inside the XML document. Link to comment Share on other sites More sharing options...
RoyT Posted September 23, 2011 Author Share Posted September 23, 2011 Well, this is basically the conclusion I came to by experimentation. This makes it difficult when you have a lot of entities and many files that use the same set. Thanks much for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.