Hi all

I've just got my first ever piece of PHP programming working so that it imports an XML file and outputs everything from it accordingly. 🙂

The next thing I want to learn is all the strict stuff about well-formed XML documents and including a Document Type Definition so that all the data is rigidly maintained and no errors creep in. I've encountered a problem though... I've setup a DTD file and am calling it from my XML sheet, yet nothing whatsoever seems to be happening. I deliberately included errors in the XML so that it would fail, yet the XML sheet is getting called just as before and everything seems to be working fine

I then changed the 2nd line in the XML sheet to be this:

<!DOCTYPE test SYSTEM "blahblah.dtd">

..so that it's now calling a non-existent file. It still works fine so the whole DTD bit is quite obviously getting ignored completely!

Any idea what I'm doing wrong?

    There are two types of XML processors, validating and non-validating. Non-validating processors does not process external DTDs, which is what you are supplying. I'm not certain, but I'd guess that a validating XML processor would have to treat a non-retrievable DTD as an error.

      Write a Reply...