From:             
Operating system: Windows 7 64bit
PHP version:      5.3.3
Package:          SimpleXML related
Bug Type:         Bug
Bug description:SimpleXML ignores XSI:TYPE attributes

Description:
------------
Hello,



It seems that SimpleXML removed all references to xsi:type in every node.

XML Parser does show the xsi:type as an attribute.



The code below demonstrates this.

Test script:
---------------
$xmlData = '<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
><node xsi:type="Test">DATA</node></root>';





// Try First with SimpleXml

$xml = simplexml_load_string($xmlData);



echo "Node XSI:TYPE = ". (string)$xml->node['xsi:type'];



// Try using XML Parser

function tag_open($parser, $tag, $attributes) {

   if (!empty($attributes)) { echo "<br /> Tag: $tag Atrributes:
".print_r($attributes,true); }

}



$parser = xml_parser_create();

xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);

xml_set_element_handler($parser, "tag_open", false);

xml_parse($parser, ltrim($xmlData));



Expected result:
----------------
Node XSI:TYPE = Test

Tag: root Atrributes: Array ( [xmlns:xsi] =>
http://www.w3.org/2001/XMLSchema-instance )

Tag: node Atrributes: Array ( [xsi:type] => Test ) 

Actual result:
--------------
Node XSI:TYPE = 

Tag: root Atrributes: Array ( [xmlns:xsi] =>
http://www.w3.org/2001/XMLSchema-instance )

Tag: node Atrributes: Array ( [xsi:type] => Test ) 

-- 
Edit bug report at http://bugs.php.net/bug.php?id=53192&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53192&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53192&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53192&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53192&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53192&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53192&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53192&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53192&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53192&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53192&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53192&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53192&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53192&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53192&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53192&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53192&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53192&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53192&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53192&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53192&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53192&r=mysqlcfg

Reply via email to