File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / simplexml / tests / 023.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
SimpleXML: Attributes with entities
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php 

$xml =<<<EOF
<?xml version='1.0'?>
<!DOCTYPE talks SYSTEM "nbsp.dtd" [
<!ELEMENT root  EMPTY>
<!ATTLIST root  attr1 CDATA #IMPLIED>
<!ENTITY  nbsp   "&#38;#x00A0;">
]>
<root attr='foo&nbsp;bar&nbsp;baz'></root>
EOF;

$sxe = simplexml_load_string($xml);

var_dump($sxe);
var_dump($sxe['attr']);
?>
===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
  ["@attributes"]=>
  array(1) {
    ["attr"]=>
    string(%d) "foo%sbar%sbaz"
  }
}
object(SimpleXMLElement)#%d (1) {
  [0]=>
  string(%d) "foo%sbar%sbaz"
}
===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>