#37763 [Opn->Bgs]: cloneNode doesn't clone namespaces of attributes

From: Date: Fri, 09 Jun 2006 14:42:05 +0000
Subject: #37763 [Opn->Bgs]: cloneNode doesn't clone namespaces of attributes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-98237@lists.php.net to get a copy of this message
ID: 37763 Updated by: rrichards@php.net Reported By: storm at rustex dot ru -Status: Open +Status: Bogus Bug Type: DOM XML related Operating System: Windows 2003, FreeBSD 5.4 PHP Version: 5.1.4 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. libxml2 bug occuring due to the default namespace being the same as the ss prefix'd namespace. Workaround is to use one of the following: - either not use the default namespace (prefixing everything with ss:) - prefix the parent node to which clone is being appendded to. In this case you would need ss:Table. - redefine the xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" declaration on the Table element. Previous Comments: ------------------------------------------------------------------------ [2006-06-09 13:22:40] storm at rustex dot ru Description: ------------ Try to work with Microsoft XML SpreadSheet. When I try clone "Column" element and insert it, namespaces of its attributes doesn't save. But if I rewrite attributes with setAttributeNS(getAttributeNS), this attribute save normal. Sorry for bad english, see example below. Reproduce code: --------------- xls.xml ------------------------ <?xml version="1.0"?> <?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <Worksheet ss:Name="xxx"> <Table> <Column ss:StyleID="s21" ss:AutoFitWidth="0" ss:Width="46.5"/> </Table> </Worksheet> </Workbook> ------------------------ code: ------------------------ $xls = new DOMDocument(); $xls->load("xls.xml"); $column = $xls->getElementsByTagName('Column')->item(0); $column2 = $column->parentNode->insertBefore($column->cloneNode(), $column); echo $xls->save("xls2.xml"); Expected result: ---------------- <?xml version="1.0" encoding="UTF-8"?> <?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <Worksheet ss:Name="xxx"> <Table> <Column StyleID="s21" AutoFitWidth="0" Width="46.5"/><Column ss:StyleID="s21" ss:AutoFitWidth="0" ss:Width="46.5"/> </Table> </Worksheet> </Workbook> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37763&edit=1

« previous php.bugs (#98237) next »