type) { case XML_ELEMENT_NODE: for($i=0; $i<$level; $i++) echo " "; echo "<".$node->name; $attributes = $node->attributes(); if(is_array($attributes)) for(reset($attributes); $attrname = key($attributes); next($attributes)) echo " ".$attrname."=".$node->getattr($attrname); echo ">\n"; $children = $node->children(); for($i=0; $i < count($children); $i++) output_node($children[$i], $level+1); for($i=0; $i<$level; $i++) echo " "; echo "name.">\n"; break; case XML_TEXT_NODE: for($i=0; $i<$level; $i++) echo " "; echo $node->content; echo "\n"; break; } } function list_attr($node) { $attr = domxml_attributes($node); for(reset($attr); $key = key($attr); next($attr)) { echo $key."=".$attr[$key]."\n"; } } $xmlstr = " Title a1b1c1 a2c2 a3b3c3 "; $dom = dom($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); $doc = newxmldoc("1.0"); $root = $doc->addroot("HTML"); echo $root->name; $root->newchild("TITLE", "Hier der Titel"); $root->newchild("BODY", ""); echo $doc->dumpmem(); ?>