note 112342 added to domelement.setattributens
| From: | hrvoj3e | Date: | Tue, 04 Jun 2013 07:03:36 +0000 |
| Subject: | note 112342 added to domelement.setattributens | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195041@lists.php.net to get a copy of this message | ||
http://stackoverflow.com/questions/2236931/php-dom-xml-create-multiple-namespace-attributes/16911033#16911033
// create DOM document
$xml = new DomDocument('1.0', 'UTF-8');
// create root element
$el = $xml->createElementNS('xttp://namespaceA/url/here/', 'rootelement');
// to be able to add new namespaces we must first add namespace 'xsi'
// third parameter is important (use your main namespace with .xsd)
$root->setAttributeNS(
'xttp://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation',
'xttp://namespaceA/url/here/ xttp://namespaceA/xsdfile/here.xsd');
// add new namespace
$el->setAttributeNS(
'http://www.w3.org/2000/xmlns/',
'xmlns:namespaceB',
'http://namespaceB/url/here/');
// add root element to DOM
$xml->appendChild($el);
----
Server IP: 69.147.83.199
Probable Submitter: 212.92.206.19
----
Manual Page -- http://php.net/manual/en/domelement.setattributens.php
Edit -- https://master.php.net/note/edit/112342
Del: integrated -- https://master.php.net/note/delete/112342/integrated
Del: useless -- https://master.php.net/note/delete/112342/useless
Del: bad code -- https://master.php.net/note/delete/112342/bad+code
Del: spam -- https://master.php.net/note/delete/112342/spam
Del: non-english -- https://master.php.net/note/delete/112342/non-english
Del: in docs -- https://master.php.net/note/delete/112342/in+docs
Del: other reasons-- https://master.php.net/note/delete/112342
Reject -- https://master.php.net/note/reject/112342
Search -- https://master.php.net/manage/user-notes.php