Kan iemand mij vertellen waarom de volgende code niks geeft?
De file dtdtest.xml ziet er zo uit:
De file test.dtd ziet er zo uit:
Zoals je ziet zit er een fout in de XML omdat de tag bar niet in de DTD staat.
Als ik aan de commandline run:
/usr/local/bin/xmllint --valid --noout dtdtest.xml
Dan krijg ik dit:
Als ik echter het bovenstaande php script run krijg ik niks!
Why oh why?
code:
1
2
3
4
| <? $a = shell_exec("/usr/local/bin/xmllint --valid --noout dtdtest.xml"); echo $a; ?> |
De file dtdtest.xml ziet er zo uit:
code:
1
2
3
4
5
6
7
8
9
| <?xml version="1.0" ?> <!DOCTYPE note SYSTEM "test.dtd"> <note> <bar> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> |
De file test.dtd ziet er zo uit:
code:
1
2
3
4
5
6
| <?xml version="1.0" ?> <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> |
Zoals je ziet zit er een fout in de XML omdat de tag bar niet in de DTD staat.
Als ik aan de commandline run:
/usr/local/bin/xmllint --valid --noout dtdtest.xml
Dan krijg ik dit:
code:
1
2
3
4
5
6
| dtdtest.xml:9: error: Opening and ending tag mismatch: bar and note </note> ^ dtdtest.xml:10: error: Premature end of data in tag note ^ |
Als ik echter het bovenstaande php script run krijg ik niks!
Why oh why?