From:             
Operating system: OSX 10.6.8
PHP version:      5.3.6
Package:          SimpleXML related
Bug Type:         Bug
Bug description:SimpleXML loses DTD declaration on simplexml_load_file

Description:
------------
I guess this may not be a bug but I can find no information about how to
import an XML with a DTD declaration (<!DOCTYPE...) and have the resulting
XML still contain the declaration when I use the asXML method.  All I get
is the file with the declaration removed.  I have tried LIBXML_DTDLOAD,
LIBXML_DTDATTR and they don't seem to help.

On a related note when I set an element using simplexml and it includes an
'&' ans part of an entity reference (i.e. &M;) it gets converted to
'&amp;'. How can I stop that?

Test script:
---------------
$exptml=
simplexml_load_file('http://chalk.coas.unf.edu/eureka/files/templates/tmpl_chm.xml');
echo $exptml->asXML();

Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- Example Chemical - ExptML v0.1 SJC 4/7/11 -->
<!DOCTYPE ExptML SYSTEM
"http://chalk.coas.unf.edu/eureka/files/exptml/exptml_entities.dtd";>
<chemical id="pid" xmlns="urn:exptml:schema:draft:0.1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:unitsml="urn:oasis:names:tc:unitsml:schema:xsd:UnitsMLSchema-1.0"
        xsi:schemaLocation="urn:exptml:schema:draft:0.1
http://chalk.coas.unf.edu/eureka/files/exptml/exptml_chemical.xsd";
version="0.1">
<name>Chemical name</name>
...
</chemical>


Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- Example Chemical - ExptML v0.1 SJC 4/7/11 -->

<chemical id="pid" xmlns="urn:exptml:schema:draft:0.1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:unitsml="urn:oasis:names:tc:unitsml:schema:xsd:UnitsMLSchema-1.0"
        xsi:schemaLocation="urn:exptml:schema:draft:0.1
http://chalk.coas.unf.edu/eureka/files/exptml/exptml_chemical.xsd";
version="0.1">
<name>Chemical name</name>
...
</chemical>


-- 
Edit bug report at https://bugs.php.net/bug.php?id=55317&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=55317&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=55317&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=55317&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=55317&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55317&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=55317&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=55317&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=55317&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=55317&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=55317&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=55317&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=55317&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=55317&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=55317&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=55317&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=55317&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=55317&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=55317&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=55317&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=55317&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=55317&r=mysqlcfg

Reply via email to