From d0cf1ec40d7ae39ad1d8a362146dffdeac2240fa Mon Sep 17 00:00:00 2001 From: Shane Caraveo Date: Thu, 9 Oct 2003 05:46:03 +0000 Subject: [PATCH] add a DTD example --- ext/dom/examples/note-invalid.xml | 9 +++++++++ ext/dom/examples/note.dtd | 6 ++++++ ext/dom/examples/note.php | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 ext/dom/examples/note-invalid.xml create mode 100644 ext/dom/examples/note.dtd create mode 100644 ext/dom/examples/note.php diff --git a/ext/dom/examples/note-invalid.xml b/ext/dom/examples/note-invalid.xml new file mode 100644 index 0000000000..58d4e65044 --- /dev/null +++ b/ext/dom/examples/note-invalid.xml @@ -0,0 +1,9 @@ + + + +PHP User Group +Shane +Reminder +Don't forget the meeting tonight! +
Or I'll clobber you!
+
diff --git a/ext/dom/examples/note.dtd b/ext/dom/examples/note.dtd new file mode 100644 index 0000000000..4016eb5811 --- /dev/null +++ b/ext/dom/examples/note.dtd @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ext/dom/examples/note.php b/ext/dom/examples/note.php new file mode 100644 index 0000000000..a8695f3664 --- /dev/null +++ b/ext/dom/examples/note.php @@ -0,0 +1,19 @@ +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"; +} + +?> -- 2.50.1