Bug #64440 [NEW]: SimpleXMLElement needs a way to add text content to a node
From: matteosistisette at gmail dot com
Operating system: all
PHP version: Irrelevant
Package: SimpleXML related
Bug Type: Bug
Bug description:SimpleXMLElement needs a way to add text content to a node
Description:
------------
There is currently no way (except for this horrible hack
http://stackoverflow.com/questions/3153477/how-can-i-set-text-value-of-
simplexmlelement-without-using-its-parent) to add or modify the text
content of a
xml node with SimpleXMLElement.
It needs methods called somethig like addTextContent() or setTextContent()
or
addTextNode() or whatever.
Now please don't tell me this is a feature request. This is a huge design
flaw.
This is the lack of an obvious, vital feature.
Test script:
---------------
$xml_a=new SimpleXMLElement("<data/>");
$xml_b=new SimpleXMLElement("<data>someText</data>");
//Now try to modify $xml_a so that it becomes like $xml_b
//It's impossible.
/* You would need something like:
$xml_a->addContent("someText");
or
$xml_a->addTextNode("someText");
or
$xml_a->setContent("someText");
No way you can accomplish that*/
--
Edit bug report at https://bugs.php.net/bug.php?id=64440&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64440&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64440&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64440&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64440&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64440&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64440&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64440&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64440&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64440&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64440&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64440&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64440&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64440&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64440&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64440&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64440&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64440&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64440&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64440&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64440&r=mysqlcfg
Thread (4 messages)
- matteosistisette at gmail dot com