-
-
Notifications
You must be signed in to change notification settings - Fork 207
Open
Description
Running error message:
Unhandled exception. System.Xml.XmlException: The prefix '' cannot be redefined from '' to 'http://schemas.openxmlformats.org/package/2006/content-types' within the same start element tag.
at System.Xml.XmlWellFormedWriter.PushNamespaceExplicit(String prefix, String ns)
at System.Xml.XmlWellFormedWriter.WriteEndAttribute()
at Peachpie.Library.XmlDom.XMLWriter.<>c__DisplayClass41_0.<writeAttribute>b__2()
at Peachpie.Library.XmlDom.XMLWriter.CheckedCall(Action operation)
at Peachpie.Library.XmlDom.XMLWriter.writeAttribute(String name, String content)
....
PHPExcel source code (PHPExcel-1.8.1): https://github.com/PHPOffice/PHPExcel
\PHPExcelPhpCsLib\PHPExcel\Writer\Excel2007\ContentTypes.php:line 61
This statement seems to be wrong:
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
demo download -> https://github.com/wujwmail/PHPExcel_test/tree/master
A php example for testing writeAttribute
<?php
$xml = new XMLWriter();
$xml->openMemory();
$xml->startElement('element');
/*
An error occurs when using xmlns attribute names
*/
$xml->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
/*
It is normal to use attribute names other than xmlns attribute names.
*/
$xml->writeAttribute('not_xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
$xml->endElement();
echo $xml->flush();
Metadata
Metadata
Assignees
Labels
No labels