[prev in list] [next in list] [prev in thread] [next in thread]
List: php-general
Subject: [PHP] Help with creating an XML Document
From: "Eric L. Sammons" <esammons () vt ! edu>
Date: 2004-06-23 14:18:19
Message-ID: 414307E9 () zathras
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic