0

Hello I just started to learn XML and DTDs and I cannot get my code to validate. I am using notepad++ to validate my code.

<?xml version="1.0"?>
<!DOCTYPE A [


<!ELEMENT A (B,D,F)>
<!ELEMENT B (C*)>
<!ELEMENT C (#PCDATA)>
<!ELEMENT D (F*)>
<!ELEMENT F (#PCDATA)>

]>

also when I made a check XML syntax I get an error mesage in line 11 (the last one)

<?xml version="1.0"?>
<!DOCTYPE A SYSTEM "d3.dtd">


<A>
    <B>
        <C></C>
        <C></C>
    </B>
    <F></F>
</A>
JIST
  • 1,139
  • 2
  • 8
  • 30
  • 1
    What's the error message? The problem is most likely that you have duplicate doctype declarations; one in your XML and one in your DTD. Try removing the one in your DTD (leave the element declarations though). See https://stackoverflow.com/a/5455469/317052 for more info. – Daniel Haley Oct 16 '18 at 15:53
  • 1
    Also, your DTD says that `D` is required, but your XML does not have a `D` element. – Daniel Haley Oct 16 '18 at 15:57
  • the error message is "Unable to load the DTD d3.dtd" – R.Alobaidi Oct 16 '18 at 17:08

0 Answers0