summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/dom/examples/note-invalid.xml9
-rw-r--r--ext/dom/examples/note.dtd6
-rw-r--r--ext/dom/examples/note.php19
3 files changed, 34 insertions, 0 deletions
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 @@
+<?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>
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 @@
+<?xml version="1.0" ?>
+<!ELEMENT note (to,from,heading,body)>
+<!ELEMENT to (#PCDATA)>
+<!ELEMENT from (#PCDATA)>
+<!ELEMENT heading (#PCDATA)>
+<!ELEMENT body (#PCDATA)> \ 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 @@
+<?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";
+}
+
+?>