shane Thu Oct 9 01:46:04 2003 EDT Added files: /php-src/ext/dom/examples note-invalid.xml note.dtd note.php Log: add a DTD example
Index: php-src/ext/dom/examples/note-invalid.xml +++ php-src/ext/dom/examples/note-invalid.xml <?xml version="1.0"?> <!DOCTYPE note SYSTEM "note.dtd"> <note> <to>PHP User Group</to> <from>Shane</from> <heading>Reminder</heading> <body>Don't forget the meeting tonight!</body> <footer>Or I'll clobber you!</footer> </note> Index: php-src/ext/dom/examples/note.dtd +++ php-src/ext/dom/examples/note.dtd <?xml version="1.0" ?> <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> Index: php-src/ext/dom/examples/note.php +++ php-src/ext/dom/examples/note.php <?php $dom = new domDocument; $dom->load('note.xml'); if (!$dom->validate('note.dtd')) { print "Document note.dtd is not valid\n"; } else { print "Document note.dtd is valid\n"; } $dom = new domDocument; $dom->load('note-invalid.xml'); if (!$dom->validate('note.dtd')) { print "Document note-invalid.xml is not valid\n"; } else { print "Document note-invalid.xml is valid\n"; } ?> -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php