From 60909f391daf5a2a61de91afe86e32b57dd4200d Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sun, 8 Oct 2017 03:09:37 +0200 Subject: [PATCH] Remove code examples from dom extension PHP documentation is a better place to present code examples. Tests for ext/dom already include all used PHP code. --- ext/dom/examples/dom1.inc | 43 -------------- ext/dom/examples/dom1.php | 94 ------------------------------- ext/dom/examples/note-invalid.xml | 9 --- ext/dom/examples/note.dtd | 6 -- ext/dom/examples/note.php | 19 ------- ext/dom/examples/note.xml | 8 --- ext/dom/examples/relaxNG.php | 11 ---- ext/dom/examples/relaxNG.rng | 11 ---- ext/dom/examples/relaxNG.xml | 1 - ext/dom/examples/relaxNG2.rng | 23 -------- ext/dom/examples/relaxNG3.rng | 8 --- ext/dom/examples/shipping.php | 11 ---- ext/dom/examples/shipping.xml | 21 ------- ext/dom/examples/shipping.xsd | 36 ------------ 14 files changed, 301 deletions(-) delete mode 100644 ext/dom/examples/dom1.inc delete mode 100644 ext/dom/examples/dom1.php delete mode 100644 ext/dom/examples/note-invalid.xml delete mode 100644 ext/dom/examples/note.dtd delete mode 100644 ext/dom/examples/note.php delete mode 100644 ext/dom/examples/note.xml delete mode 100644 ext/dom/examples/relaxNG.php delete mode 100644 ext/dom/examples/relaxNG.rng delete mode 100644 ext/dom/examples/relaxNG.xml delete mode 100644 ext/dom/examples/relaxNG2.rng delete mode 100644 ext/dom/examples/relaxNG3.rng delete mode 100644 ext/dom/examples/shipping.php delete mode 100644 ext/dom/examples/shipping.xml delete mode 100644 ext/dom/examples/shipping.xsd diff --git a/ext/dom/examples/dom1.inc b/ext/dom/examples/dom1.inc deleted file mode 100644 index 792d6f2dbc481..0000000000000 --- a/ext/dom/examples/dom1.inc +++ /dev/null @@ -1,43 +0,0 @@ - - -]> - -Title - -&sp; - - - - -a1b1c1 -a2c2 -a3b3c3 - - - - - "; - -function print_node($node) -{ - print "Node Name: " . $node->nodeName; - print "\nNode Type: " . $node->nodeType; - $child_count = $node->childNodes->length; - print "\nNum Children: " . $child_count; - if($child_count <= 1){ - print "\nNode Content: " . $node->nodeValue; - } - print "\n\n"; -} - -function print_node_list($nodelist) -{ - foreach($nodelist as $node) - { - print_node($node); - } -} - -?> diff --git a/ext/dom/examples/dom1.php b/ext/dom/examples/dom1.php deleted file mode 100644 index 8ea367458d6f6..0000000000000 --- a/ext/dom/examples/dom1.php +++ /dev/null @@ -1,94 +0,0 @@ -loadxml($xmlstr); -if(!$dom) { - echo "Error while parsing the document\n"; - exit; -} - -// children() of of document would result in a memleak -//$children = $dom->children(); -//print_node_list($children); - -echo "--------- root\n"; -$rootnode = $dom->documentElement; -print_node($rootnode); - -echo "--------- children of root\n"; -$children = $rootnode->childNodes; -print_node_list($children); - -// The last node should be identical with the last entry in the children array -echo "--------- last\n"; -$last = $rootnode->lastChild; -print_node($last); - -// The parent of this last node is the root again -echo "--------- parent\n"; -$parent = $last->parentNode; -print_node($parent); - -// The children of this parent are the same children as one above -echo "--------- children of parent\n"; -$children = $parent->childNodes; -print_node_list($children); - -echo "--------- creating a new attribute\n"; -//This is worthless -//$attr = $dom->createAttribute("src", "picture.gif"); -//print_r($attr); - -//$rootnode->set_attributeNode($attr); -$attr = $rootnode->setAttribute("src", "picture.gif"); -$attr = $rootnode->getAttribute("src"); -print_r($attr); -print "\n"; - -echo "--------- Get Attribute Node\n"; -$attr = $rootnode->getAttributeNode("src"); -print_node($attr); - -echo "--------- Remove Attribute Node\n"; -$attr = $rootnode->removeAttribute("src"); -print "Removed " . $attr . " attributes.\n"; - -echo "--------- attributes of rootnode\n"; -$attrs = $rootnode->attributes; -print_node_list($attrs); - -echo "--------- children of an attribute\n"; -$children = $attrs->item(0)->childNodes; -print_node_list($children); - -echo "--------- Add child to root\n"; -$myelement = new domElement("Silly", "Symphony"); -$newchild = $rootnode->appendChild($myelement); -print_node($newchild); -print $dom->saveXML(); -print "\n"; - -echo "--------- Find element by tagname\n"; -echo " Using dom\n"; -$children = $dom->getElementsByTagname("Silly"); -print_node_list($children); - -echo " Using elem\n"; -$children = $rootnode->getElementsByTagName("Silly"); -print_node_list($children); - -echo "--------- Unlink Node\n"; -print_node($children->item(0)); -$rootnode->removeChild($children->item(0)); -print_node_list($rootnode->childNodes); -print $dom->savexml(); - -echo "--------- Find element by id\n"; -print ("Not implemented\n"); - -echo "--------- Check various node_name return values\n"; -print ("Not needed\n"); - -?> diff --git a/ext/dom/examples/note-invalid.xml b/ext/dom/examples/note-invalid.xml deleted file mode 100644 index 58d4e650441bb..0000000000000 --- a/ext/dom/examples/note-invalid.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - -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 deleted file mode 100644 index c2d558eee4eb5..0000000000000 --- a/ext/dom/examples/note.dtd +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/ext/dom/examples/note.php b/ext/dom/examples/note.php deleted file mode 100644 index a8695f3664442..0000000000000 --- a/ext/dom/examples/note.php +++ /dev/null @@ -1,19 +0,0 @@ -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"; -} - -?> diff --git a/ext/dom/examples/note.xml b/ext/dom/examples/note.xml deleted file mode 100644 index 49614a1b5256c..0000000000000 --- a/ext/dom/examples/note.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - -PHP User Group -Shane -Reminder -Don't forget the meeting tonight! - diff --git a/ext/dom/examples/relaxNG.php b/ext/dom/examples/relaxNG.php deleted file mode 100644 index d265fd988e185..0000000000000 --- a/ext/dom/examples/relaxNG.php +++ /dev/null @@ -1,11 +0,0 @@ -load('relaxNG.xml'); -if (!$dom->relaxNGValidate('relaxNG.rng')) { - print "Document is not valid"; -} else { - print "Document is valid"; -} - -?> \ No newline at end of file diff --git a/ext/dom/examples/relaxNG.rng b/ext/dom/examples/relaxNG.rng deleted file mode 100644 index f4357e04ef8ab..0000000000000 --- a/ext/dom/examples/relaxNG.rng +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - diff --git a/ext/dom/examples/relaxNG.xml b/ext/dom/examples/relaxNG.xml deleted file mode 100644 index 6b0cac1225050..0000000000000 --- a/ext/dom/examples/relaxNG.xml +++ /dev/null @@ -1 +0,0 @@ -hello \ No newline at end of file diff --git a/ext/dom/examples/relaxNG2.rng b/ext/dom/examples/relaxNG2.rng deleted file mode 100644 index 4adae7b15113d..0000000000000 --- a/ext/dom/examples/relaxNG2.rng +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ext/dom/examples/relaxNG3.rng b/ext/dom/examples/relaxNG3.rng deleted file mode 100644 index 73e1eb6165102..0000000000000 --- a/ext/dom/examples/relaxNG3.rng +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ext/dom/examples/shipping.php b/ext/dom/examples/shipping.php deleted file mode 100644 index 5205fd2014cb6..0000000000000 --- a/ext/dom/examples/shipping.php +++ /dev/null @@ -1,11 +0,0 @@ -load('shipping.xml'); -if (!$dom->schemaValidate('shipping.xsd')) { - print "Document is not valid"; -} else { - print "Document is valid"; -} - -?> \ No newline at end of file diff --git a/ext/dom/examples/shipping.xml b/ext/dom/examples/shipping.xml deleted file mode 100644 index dc8a09e301768..0000000000000 --- a/ext/dom/examples/shipping.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - Tove Svendson - Ragnhildvei 2 -
4000 Stavanger
- Norway -
- - - Empire Burlesque - 1 - 10.90 - - - Hide your heart - 1 - 9.90 - - -
\ No newline at end of file diff --git a/ext/dom/examples/shipping.xsd b/ext/dom/examples/shipping.xsd deleted file mode 100644 index 8b16b7c03a621..0000000000000 --- a/ext/dom/examples/shipping.xsd +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file