]> granicus.if.org Git - php/commitdiff
Remove code examples from dom extension
authorPeter Kokot <peterkokot@gmail.com>
Sun, 8 Oct 2017 01:09:37 +0000 (03:09 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 8 Oct 2017 15:50:17 +0000 (17:50 +0200)
PHP documentation is a better place to present code examples. Tests
for ext/dom already include all used PHP code.

14 files changed:
ext/dom/examples/dom1.inc [deleted file]
ext/dom/examples/dom1.php [deleted file]
ext/dom/examples/note-invalid.xml [deleted file]
ext/dom/examples/note.dtd [deleted file]
ext/dom/examples/note.php [deleted file]
ext/dom/examples/note.xml [deleted file]
ext/dom/examples/relaxNG.php [deleted file]
ext/dom/examples/relaxNG.rng [deleted file]
ext/dom/examples/relaxNG.xml [deleted file]
ext/dom/examples/relaxNG2.rng [deleted file]
ext/dom/examples/relaxNG3.rng [deleted file]
ext/dom/examples/shipping.php [deleted file]
ext/dom/examples/shipping.xml [deleted file]
ext/dom/examples/shipping.xsd [deleted file]

diff --git a/ext/dom/examples/dom1.inc b/ext/dom/examples/dom1.inc
deleted file mode 100644 (file)
index 792d6f2..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?PHP
-$xmlstr = "<?xml version='1.0' standalone='yes'?>
-<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
-[ <!ENTITY sp \"spanish\">
-]>
-<!-- lsfj  -->
-<chapter language='en'><title language='en'>Title</title>
-<para language='ge'>
-&sp;
-<!-- comment -->
-<informaltable language='&sp;kkk'>
-<tgroup cols='3'>
-<tbody>
-<row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row>
-<row><entry>a2</entry><entry>c2</entry></row>
-<row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row>
-</tbody>
-</tgroup>
-</informaltable>
-</para>
-</chapter> ";
-
-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 (file)
index 8ea3674..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-require_once("dom1.inc");
-
-echo "Test 1: accessing single nodes from php\n";
-$dom = new domDocument;
-$dom->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 (file)
index 58d4e65..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<?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
deleted file mode 100644 (file)
index c2d558e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!ELEMENT note (to,from,heading,body)>
-<!ELEMENT to (#PCDATA)>
-<!ELEMENT from (#PCDATA)>
-<!ELEMENT heading (#PCDATA)>
-<!ELEMENT body (#PCDATA)>
diff --git a/ext/dom/examples/note.php b/ext/dom/examples/note.php
deleted file mode 100644 (file)
index a8695f3..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?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";
-}
-
-?>
diff --git a/ext/dom/examples/note.xml b/ext/dom/examples/note.xml
deleted file mode 100644 (file)
index 49614a1..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?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>
-</note> 
diff --git a/ext/dom/examples/relaxNG.php b/ext/dom/examples/relaxNG.php
deleted file mode 100644 (file)
index d265fd9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-$dom = new domDocument;
-$dom->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 (file)
index f4357e0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<grammar xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
-
-<include href="relaxNG2.rng">
-<define name="TEI.prose"><ref name="INCLUDE"/></define>
-</include>
-</grammar>
-
-
-
diff --git a/ext/dom/examples/relaxNG.xml b/ext/dom/examples/relaxNG.xml
deleted file mode 100644 (file)
index 6b0cac1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<TEI.2>hello</TEI.2>
\ No newline at end of file
diff --git a/ext/dom/examples/relaxNG2.rng b/ext/dom/examples/relaxNG2.rng
deleted file mode 100644 (file)
index 4adae7b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:t="http://www.thaiopensource.com/ns/annotations" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
-
-   <start>
-         <ref name="TEI.2"/>
-   </start>
-   <define name="IGNORE">
-      <notAllowed/>
-   </define>
-   <define name="INCLUDE">
-      <empty/>
-   </define>
-
-
-  <include href="relaxNG3.rng"/>
-
-   <define name="TEI.2">
-      <element name="TEI.2">
-         <text/>
-      </element>
-   </define>
-
-</grammar>
\ No newline at end of file
diff --git a/ext/dom/examples/relaxNG3.rng b/ext/dom/examples/relaxNG3.rng
deleted file mode 100644 (file)
index 73e1eb6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:t="http://www.thaiopensource.com/ns/annotations" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
-
-   <define name="TEI.prose" combine="interleave">
-      <ref name="IGNORE"/>
-   </define>
-
-</grammar>
\ No newline at end of file
diff --git a/ext/dom/examples/shipping.php b/ext/dom/examples/shipping.php
deleted file mode 100644 (file)
index 5205fd2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-$dom = new domDocument;
-$dom->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 (file)
index dc8a09e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<shipOrder>
-  <shipTo>
-    <name>Tove Svendson</name>
-    <street>Ragnhildvei 2</street>
-    <address>4000 Stavanger</address>
-    <country>Norway</country>
-  </shipTo>
-  <items>
-    <item>
-      <title>Empire Burlesque</title>
-      <quantity>1</quantity>
-      <price>10.90</price>
-    </item>
-    <item>
-      <title>Hide your heart</title>
-      <quantity>1</quantity>
-      <price>9.90</price>
-    </item>
-  </items>
-</shipOrder>
\ No newline at end of file
diff --git a/ext/dom/examples/shipping.xsd b/ext/dom/examples/shipping.xsd
deleted file mode 100644 (file)
index 8b16b7c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
-
-    <xsd:element       name="shipOrder" type="order"/> 
-    
-    <xsd:complexType   name="order">
-        <xsd:all>
-            <xsd:element   name="shipTo"    type="shipAddress"/>
-            <xsd:element   name="items"     type="cdItems"/>
-        </xsd:all>
-    </xsd:complexType> 
-    
-    <xsd:complexType   name="shipAddress">
-        <xsd:all>
-            <xsd:element   name="name"      type="xsd:string"/>
-            <xsd:element   name="street"    type="xsd:string"/>
-            <xsd:element   name="address"   type="xsd:string"/>
-            <xsd:element   name="country"   type="xsd:string"/>
-        </xsd:all>
-    </xsd:complexType> 
-    
-    <xsd:complexType   name="cdItems">
-        <xsd:sequence>
-            <xsd:element   name="item"      type="cdItem"  maxOccurs="unbounded" minOccurs="1"/>
-        </xsd:sequence>
-    </xsd:complexType> 
-    
-    <xsd:complexType   name="cdItem">
-        <xsd:all>
-            <xsd:element   name="title"     type="xsd:string"/>
-            <xsd:element   name="quantity"  type="xsd:positiveInteger"/>
-            <xsd:element   name="price"     type="xsd:decimal"/>
-        </xsd:all>
-    </xsd:complexType> 
-
-</xsd:schema>
\ No newline at end of file