I think you only have to change one line of your php code:

$text = $doc->create_text_node("000000");
instead of
$text = $doc->create_text_node($el["000000"]);

With best regards

Gabriel Birke

--
KONTOR4_Neue Medien
Plathnerstraße 5
30175 Hannover
Fax: +49 51184 48 98 99
mailto:[EMAIL PROTECTED]
http://www.kontor4.de
Am 23.06.2004 um 16:18 schrieb Eric L. Sammons:

Using PHP 4.3.2 I am trying to create an XML file that looks similar to the
following:


<?xml version="1.0" encoding="UTF-8"?>
<Server Name="pxtest01">
<Serical_Number>000000000</Serical_Number>
<Asset_Tag>00000</Asset_Tag>
<Model>DL380</Model>
<Location>8th Floor</Location>
<Cabinet>2</Cabinet>
<Application_Group>Customer</Application_Group>
<Purpose>Upgrade</Purpose>
</server>


I get the following output:

<?xml version="1.0"?> <Server
Name="pxtest01"><Serial_Number></Serial_Number></server>

Using the following code:

<?php

$doc = domxml_new_doc("1.0");
$root = $doc->add_root("Server");
$root->set_attribute("Name", "pxtest01");
$el = $doc->create_element("Serial_Number");
$root->append_child($el);
$text = $doc->create_text_node($el["000000"]);
$el->append_child($text);
print htmlentities($doc->dump_mem());

?>

Can someone help me fix my code so that when I add an element I can also set
some contents or a value for that element? example
<serial_number>0000000</serial_number>


Thank you!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to