logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

cvs: pecl /sdo/tests/interop interop-xml.php: msg#00115

Subject: cvs: pecl /sdo/tests/interop interop-xml.php
cem             Fri Nov 24 10:44:35 2006 UTC

  Modified files:              
    /pecl/sdo/tests/interop     interop-xml.php 
  Log:
  merge BRANCH_1_0_5 into trunk
  
http://cvs.php.net/viewvc.cgi/pecl/sdo/tests/interop/interop-xml.php?r1=1.1&r2=1.2&diff_format=u
Index: pecl/sdo/tests/interop/interop-xml.php
diff -u pecl/sdo/tests/interop/interop-xml.php:1.1 
pecl/sdo/tests/interop/interop-xml.php:1.2
--- pecl/sdo/tests/interop/interop-xml.php:1.1  Thu Sep 14 12:16:18 2006
+++ pecl/sdo/tests/interop/interop-xml.php      Fri Nov 24 10:44:35 2006
@@ -18,7 +18,7 @@
 +----------------------------------------------------------------------+
 | Author: SL                                                           |
 +----------------------------------------------------------------------+
-$Id: interop-xml.php,v 1.1 2006/09/14 12:16:18 slaws Exp $
+$Id: interop-xml.php,v 1.2 2006/11/24 10:44:35 cem Exp $
 */
 
 /* 
@@ -54,7 +54,7 @@
   $message = $reason . "  " . $nodename . ": Node1 count = $count1   Node2 
count  = $count2";
 
   if ( $count1 != $count2  ){
-    throw new Exception ( $message );
+      throw new Exception ( $message );
   }
  
   if ( DEBUG == "on" ){
@@ -107,29 +107,59 @@
  */
 function compareNodeAttributes ( $node1, $node2, $namespace )
 {
-  // attributes in the default namespace
   $attributes1 = $node1->attributes($namespace);
   $attributes2 = $node2->attributes($namespace);
-
-  $reason = "ATTRIBUTE COUNT FOR NAMESPACE ";
-
-  if ( $namespace == NULL ){
-    $reason = $reason . "DEFAULT";
+ 
+  $count1 = count ($node1);
+  $count2 = count ($node2);
+  
+  $message = "for node " . $node1->getName() . " in namespace " . $namespace . 
" - ";
+  
+  for ( $i = 0; $i < $count1; $i += 1 ) {
+      $att1      = $attributes1[$i];
+      $att1_type = gettype($att1);
+      $att1_name = null;
+      $att2      = $attributes2[$i];
+      $att2_type = gettype($att2);
+      $att2_name = null;
+      
+      if ( $att1 != null && $att1_type != "NULL" ) {
+         $att1_name = $att1->getName();
+      } 
+      
+      if ( $att2 != null && $att2_type != "NULL" ) {
+         $att2_name = $att2->getName();
+      }
+            
+      if ( $att1_type != $att2_type || $att1_name != $att2_name ) {
+          $message = $message . "Attribute $i not equal AttributeA = " . 
$att1_name . "  " . $att1 . " type " . $att1_type . " AttributeB = " . 
$att2_name . " " . $att2 . " type " . $att2_type;
+          
+          // test for a special case because we know schema location isn't 
copied to output
+          if ( $att1_name == "schemaLocation"  || $att1_name == 
"noNamespaceSchemaLocation" ) {
+              //echo $message . "\n";
+          } else {
+              throw new Exception ( $message );
+          }
+      } 
   }
-  else
-  {
-    $reason = $reason . $namespace;
+  
+  if ( $count1 != $count2 ) {
+         $message = $message . "Attribute counts not equal count1 = " . 
$count1 . " count2 = " . $count2;
+         throw new Exception ( $message );
   }
-
-  $attributecount = compareNodeCount ( $node1->getName(), $attributes1, 
$attributes2, $reason );
-
+  
+  $attributecount = $count1;
+  
   if ( DEBUG == "on" && $attributecount > 0){
     echo "ATTRIBUTES\n";
   }
 
+  /*
   for ( $i = 0; $i < $attributecount; $i += 1) {
     compareXMLAttribute ( $attributes1[$i], $attributes2[$i] );
   }
+  */
+
 }
 
 /* 



<Prev in Thread] Current Thread [Next in Thread>