note 113207 rejected from simplexmlelement.attributes by sobak

From: Date: Fri, 24 Oct 2014 07:03:22 +0000
Subject: note 113207 rejected from simplexmlelement.attributes by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-200723@lists.php.net to get a copy of this message
Note Submitter: asifworking38 at gmail dot com ---- How I will use this for an External XML file..? <?php $xml = <<<XML <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> <Table Foo="AsifMushtaq" ss:ExpandedColumnCount="7"> </Table> </Workbook> XML; $sxml = new SimpleXMLElement($xml); /** * Access attribute of default namespace */ var_dump((string) $sxml->Table[0]['Foo']); // outputs: 'Bar' /** * Access attribute of non-default namespace */ var_dump((int) $sxml->Table[0]['ExpandedColumnCount']); // outputs: 0 var_dump((int) $sxml->Table[0]->attributes('ss', TRUE)->ExpandedColumnCount); // outputs: '7' ?>

« previous php.notes (#200723) next »