note 84090 deleted from domdocument.createattribute by felipe
| From: | felipe@php.net | Date: | Fri, 27 Jun 2008 13:40:11 +0000 |
| Subject: | note 84090 deleted from domdocument.createattribute by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-140869@lists.php.net to get a copy of this message | ||
Note Submitter: adolfoaguirre dot com dot mx
Reason: 4
----
// create a xml document
$dom_xml = new DomDocument('1.0');
// for a fast example, an xml node youve creater some there
$element=$dom_xml->createElement("item");
$item_xml =$dom_xml->appendChild($element);
// now you wish an id attribute inside
// create and append the id attribute
$element=dom_xml->createAttribute("id");
$id_attribute=$item_xml->appendChild($element);
// populate the attribute
$element=$dom_xml->createTextNode(12)
$id_attribute->appendChild($element);
//
... y listo!
so you will have in your xml something like ... <item id="12">
hehe, este es mi primer código en php
y ya los estoy mal encaminando a ustedes que me hagan caso.