Bug #55317 [Fbk->NoF]: SimpleXML loses DTD declaration on simplexml_load_file

From: Date: Sun, 11 Sep 2016 04:22:33 +0000
Subject: Bug #55317 [Fbk->NoF]: SimpleXML loses DTD declaration on simplexml_load_file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203956@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55317&edit=1

 ID:               55317
 Updated by:       php-bugs@lists.php.net
 Reported by:      schalk at unf dot edu
 Summary:          SimpleXML loses DTD declaration on simplexml_load_file
-Status:           Feedback
+Status:           No Feedback
 Type:             Bug
 Package:          SimpleXML related
 Operating System: OSX 10.6.8
 PHP Version:      5.3.6
 Assigned To:      cmb
 Private report:   N

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2016-09-01 22:44:12] cmb@php.net

I can't reproduce this issue with current PHP-5.6. Can anybody
else?

------------------------------------------------------------------------
[2012-02-25 20:11:42] virtual dot greg at gmail dot com

See my gist for test code and output: https://gist.github.com/1910382

------------------------------------------------------------------------
[2012-02-25 20:07:04] virtual dot greg at gmail dot com

This does not manifest in 5.3.8 on OS X 10.6.8, the '<!DOCTYPE' is not removed.

I'd post my test script and output but I keep getting the error "Please do not 
SPAM our bug system."

------------------------------------------------------------------------
[2011-07-29 11:44:00] schalk at unf dot edu

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 this bug report at https://bugs.php.net/bug.php?id=55317&edit=1


Thread (5 messages)

« previous php.bugs (#203956) next »