note 18838 deleted from function.domxml-children by nlopess

From: Date: Mon, 28 Jun 2004 15:07:07 +0000
Subject: note 18838 deleted from function.domxml-children by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72034@lists.php.net to get a copy of this message
Note Submitter: ken@positive-edge.com ---- I'm going to tell you a much better solution to the above white space issue. Do you really want to edit a 800k or even an 800 meg XML file to fix the white space? Probably not. Sorry mux space. Every node has a member called 'name', which will tell you the element's name. Since text nodes don't have an element name (they simply return as 'text'), you can safely avoid these. Here is an example function findApplicationNode( $root, $applicationName ) { $applications = $root->children(); foreach( $applications as $applicationNode ) { if( $applicationNode->name == 'application' ) { if( $applicationNode->getattr( 'name' ) == $applicationName ) { return $applicationNode; } } } } Notice as I iterate through each node, I check the node's name field to see if it equals the desired element name using the code: if( $applicationNode->name == 'application' ).. Ken Egervari, Positive Edge

« previous php.notes (#72034) next »