note 99306 deleted from simplexmlelement.addChild by danbrown

From: Date: Fri, 28 Jan 2011 14:34:10 +0000
Subject: note 99306 deleted from simplexmlelement.addChild by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176451@lists.php.net to get a copy of this message
Note Submitter: Marcio ---- If you add a namespace to a parent element, it will be applied recursively over it's children, if any. When we do, ie: <?php $hostAttr = $simpleXmlNsNode->addChild('domain:hostAttr', null, 'someNsUriHere'); $hostName = $hostAttr->addChild('domain:hostName', $nsNome); $hostAddr = $hostAttr->addChild('domain:hostAddr', $nsEndereco); ?> We get: <domain:hostAttr> <domain:hostName></domain:hostName> <domain:hostAddr></domain:hostAddr> </domain:hostAttr>' If we haven't specific the uri address we would get: <hostAttr> <hostName></hostName> <hostAddr></hostAddr> </hostAttr> Hope this is precise and, if so, that it helps someone. Regards.

« previous php.notes (#176451) next »