$maxDepth) return; $node = $curNode; while($node != NULL) { if($node->nodeName == "#text") { $node = $node->nextSibling; continue; } for( $i = 0 ; $i < $curDepth; $i++ ) { echo "    "; } echo "<".$node->nodeName; if($node->hasAttributes()) { $attrs = $node->attributes; for ( $i = 0 ; $i < $attrs->length ; $i++ ) { echo ' '.$attrs->item($i)->nodeName.'="'.$attrs->item($i)->nodeValue.'"'; } } echo ">"; echo ": ".$node->firstChild->nodeValue."
"; XMLTraversal($node->firstChild->nextSibling, $curDepth+1); $node = $node->nextSibling; } } ?> load("books.xml"); $root = $domObj->documentElement; ?> XML Reader ½Ç½À
ÃÖ´ë Æ®¸® Ãâ·Â ±íÀÌ :