Bug #53192 [Opn->Bgs]: SimpleXML ignores XSI:TYPE attributes

From: Date: Thu, 28 Oct 2010 18:34:46 +0000
Subject: Bug #53192 [Opn->Bgs]: SimpleXML ignores XSI:TYPE attributes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155603@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53192&edit=1

 ID:                 53192
 Updated by:         rrichards@php.net
 Reported by:        jesse at eonstreet dot com
 Summary:            SimpleXML ignores XSI:TYPE attributes
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            SimpleXML related
 Operating System:   Windows 7 64bit
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

it works based on namespace scope so you need to tell it what namespace
is in 
current scope for it to access the elements/attributes


Previous Comments:
------------------------------------------------------------------------
[2010-10-28 16:01:01] jesse at eonstreet dot com

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 this bug report at http://bugs.php.net/bug.php?id=53192&edit=1


Thread (2 messages)

« previous php.bugs (#155603) next »