From:             daniel dot gorski at develnet dot org
Operating system: Linux
PHP version:      5.3CVS-2008-04-18 (CVS)
PHP Bug Type:     DOM XML related
Bug description:  DOMDocumentFragment::appendXML() stumbles over namespaces

Description:
------------
The DOMDocumentFragment::appendXML() function spits warnings if it comes
to insertion of XML with namespace-prefixed elements.

This of course would make sense if the namespaces were not definied, but
they are - at least in the parent document.

regards dtg

Reproduce code:
---------------
<?php

  error_reporting(E_ALL);

  $doc = new DOMDocument();
  $doc->loadXML('<root xmlns:name="..."/>');

  $frag = $doc->createDocumentFragment();
  $frag->appendXML('<name:element>text</name:element>');

  $doc->documentElement->appendChild($frag);

  echo htmlentities($doc->saveXML());
?>

Expected result:
----------------
<?xml version="1.0"?> <root
xmlns:name="..."><element>text</element></root>

Actual result:
--------------
Warning: DOMDocumentFragment::appendXML() [domdocumentfragment.appendxml]:
namespace error : Namespace prefix name on element is not defined in ... on
line 9

Warning: DOMDocumentFragment::appendXML() [domdocumentfragment.appendxml]:
<name:element>text</name:element> in ... on line 9

Warning: DOMDocumentFragment::appendXML() [domdocumentfragment.appendxml]:
^ in ... on line 9
<?xml version="1.0"?> <root
xmlns:name="..."><element>text</element></root>

-- 
Edit bug report at http://bugs.php.net/?id=44773&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44773&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44773&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44773&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44773&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44773&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44773&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44773&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44773&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44773&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44773&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44773&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44773&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44773&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44773&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44773&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44773&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44773&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44773&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44773&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44773&r=mysqlcfg

Reply via email to