Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added Examples

git-svn-id: http://svn.php.net/repository/pear/packages/XML_Tree/trunk@159636 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit c63d62cb17d059af753bbecf02b96e31f154b466 1 parent ebafb94
Davey Shafik dshafik authored
20 docs/examples/cdata_sections_1.php
View
@@ -0,0 +1,20 @@
+<?php
+
+require_once 'XML/Tree.php';
+
+$tree = new XML_Tree;
+
+$root =& $tree->addRoot('root');
+
+//$tree->useCdataSections();
+
+$root->addChild('foo','bar');
+
+$baz =& $root->addChild('baz');
+
+$baz->addChild('bat','qux', array(), null, true);
+$baz->addChild('bat','quux', array(), null, false);
+
+$tree->dump();
+
+?>
34 docs/examples/error_handling_1.php
View
@@ -0,0 +1,34 @@
+<?php
+
+require_once 'XML/Tree.php';
+
+$tree = new XML_Tree;
+
+$root =& $tree->addRoot('_#:A');
+
+/* Check for error on the Root node */
+
+if (PEAR::isError($root->error)) {
+ var_dump($root->error);
+}
+
+$child =& $root->addChild('abc:def', 'bar');
+
+if (PEAR::isError($child)) {
+ var_dump($child);
+}
+
+$root->registerName('abc','http://some_name_space');
+
+$child->registerName('abc', 'http://some_other_name_space');
+
+
+echo $tree->getNodeNamespace($child);
+
+if (PEAR::isError($child)) {
+ var_dump($child);
+}
+
+echo $tree->get();
+
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.