• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with DTD external reference

 
nagarjuna borra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have an xml file:

<?xml version="1.0"?>
<!DOCTYPE dipr [
<!ELEMENT dip (#PCDATA)>
<!ATTLIST dip id ID #IMPLIED>
]>
<dipr>
<dip id="101">1010</dip>
</dipr>

and getElementById works well with internal dtd .

but when i use external reference, getElementById is returning null.

here is the xml file and dtd file:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE dipr SYSTEM "file.dtd">
<dipr>
<dip id="101">1010</dip>
<dipr>

<!ELEMENT dipr (dip)>
<!ELEMENT dip (#PCDATA)>
<!ATTLIST dip id ID #IMPLIED>

what should i do to make it work???
 
Paul Clapham
Sheriff
Posts: 21117
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should arrange things so that the parser can find your external DTD.
 
nagarjuna borra
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:You should arrange things so that the parser can find your external DTD.


did you mean the external DTD ??

i put it in the same directory as that of the xml file and html file(with js).
 
Paul Clapham
Sheriff
Posts: 21117
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nagarjuna borra wrote:
Paul Clapham wrote:You should arrange things so that the parser can find your external DTD.


did you mean the external DTD ??


Yes, that's correct, when I said "external DTD" I did indeed mean "external DTD".

i put it in the same directory as that of the xml file and html file(with js).


I don't know what HTML and Javascript have to do with this, but if it's in the same directory as the XML file you posted, then that's the right place for it. The parser will know that it's in the same directory. Now make sure that the parser knows what directory the XML file is in, or else that it has a URL pointing to the XML file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic