>===== Original Message From "Eric L. Sammons" <[EMAIL PROTECTED]> =====
I am in the process of writing a PHP program. It is really quite simple, I
have a form that I complete, the information is then to be saved into a simple
XML file. When I do this in Java the XML file would appear simply as follows:
<?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>
However, when attempting this in PHP I seem only able to get the following:
<?xml version="1.0"?> <Server
Name="pxtest01"><Serial_Number></Serial_Number></server>
The code I use to get this much follows:
<?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());
?>
My question is a simple one I am sure; however, I have been unable to find the
answer... How do I add a value or content to an element. For example:
<Serial_Number>0000000</Serial_Number>
While I am at it, is there an easy way to get the DOM to dump in a nicer more
readible format?
Thank you!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php