|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-10-29 21:55 UTC] sveta at microbecal dot com
Description:
------------
When I use XML document with namespace definitions, I can't get attributes of nodes
Reproduce code:
---------------
$xml_file = 'test.xml';
$xml = simplexml_load_file($xml_file);
foreach($xml->Worksheet->attributes() as $a => $b) {
echo $a,'="',$b,"\"\n";
}
test.xml:
<?xml version="1.0"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<Worksheet ss:Name="English">
</Worksheet>
</Workbook>
Expected result:
----------------
Name="English"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
$xml_file = 'test.xml'; $xml = simplexml_load_file($xml_file); foreach($xml->Worksheet->attributes('urn:schemas-microsoft-com:office:spreadsheet') as $a => $b) { echo $a,'="',$b,"\"\n"; } Thank you for pointing me to my mistakes