|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-02-25 20:07 UTC] virtual dot greg at gmail dot com
[2012-02-25 20:11 UTC] virtual dot greg at gmail dot com
[2016-09-01 22:44 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2016-09-01 22:44 UTC] cmb@php.net
[2016-09-11 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 19:00:02 2025 UTC |
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 '&'. 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>