diff options
author | Uwe Steinmann <steinm@php.net> | 2000-02-10 15:24:13 +0000 |
---|---|---|
committer | Uwe Steinmann <steinm@php.net> | 2000-02-10 15:24:13 +0000 |
commit | 992e808451faa8351586468093bb71f4061fd902 (patch) | |
tree | b70962b035b025f99cd100e1a5c1de4877eb12a2 /tests | |
parent | e79c87aca03e5356007c00da3c8de35e92d55f32 (diff) | |
download | php-git-992e808451faa8351586468093bb71f4061fd902.tar.gz |
- added funktion xmltree(), renamed dom() to xmldoc() and domfile()
to xmldocfile().
- testdom covers most of the functionality
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testdom | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/testdom b/tests/testdom index c668813031..e8e01a94bd 100644 --- a/tests/testdom +++ b/tests/testdom @@ -37,8 +37,8 @@ function list_attr($node) { $xmlstr = "<?xml version='1.0'?> <!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'> <chapter language='en'><title language='en'>Title</title> -<para language='en'> -<informaltable language='en'> +<para language='ge'> +<informaltable language='sp'> <tgroup cols='3'> <tbody> <row><entry>a1</entry><entry morerows='1'>b1</entry><entry>c1</entry></row> @@ -50,17 +50,25 @@ $xmlstr = "<?xml version='1.0'?> </para> </chapter> "; -$dom = dom($xmlstr); +/* The following code traverses the xml tree node by node + by using the methods of the xmlnode object +*/ +echo "Test 1: accessing single nodes from php\n"; +$dom = xmldoc($xmlstr); echo "XML Version: ".$dom->version."\n"; $dtd = $dom->dtd(); $rootnode = $dom->root(); -/* The following line causes a segm fault if more than 5 methods are in - class node, see ext/domxml/domxml.c */ -$attr = $rootnode->getattr("language"); - -/* if the above weren't there, php will probably crash somewhere after here */ output_node($rootnode); +/* This one creates a dom tree made of php objects */ +echo "Test 2: creating a tree with php objects\n"; +$dom = xmltree($xmlstr); +var_dump($dom); +echo $dom->root->name; +echo "\n"; + +/* The following builds a xml document from scratch */ +echo "Test 3: building a xml document from scratch\n"; $doc = newxmldoc("1.0"); $root = $doc->addroot("HTML"); $head = $root->newchild("HEAD", ""); |