Greetings!
I have been working on a project that will, in part, use XML to store the
user list and personal info of the application's users.
Here is the general look of a single user node (a single xml file contains n
users)=
<user name="username" type="personal">
<host>site1.com</host>
<personalInfo>
<fullName>John Doe</fullName>
<email>[EMAIL PROTECTED]</email>
<maxSpace>100</maxSpace>
</personalInfo>
</user>
When i access, update or delete these nodes, everything works fine. BUT,
when i try to add a new node, it comes out all on a single line.: here is
how i do the addition:
function addUser($_username, $_file, $_name, $_email, $_quota, $_type,
$_virtualhost)
{
$xmlContent = implode(file($_file), "");
$doc = xmldoc($xmlContent);
// Recuperate the root node
$root = $doc->root();
// Create the node user amd it's sub nodes
// ----------------------------------------
$user = $root->new_child("user","");
$user->setattr("name", $_username);
$user->setattr("type", $_type);
$user->new_child("host", $_virtualhost);
$personalInfo = $user->new_child("personalInfo", "");
$personalInfo->new_child("fullName", $_name);
$personalInfo->new_child("email", $_email);
$personalInfo->new_child("maxSpace", $_quota);
// Save every thing in the xml file
// --------------------------------
if(!($myFile = fopen($_file, "w")))
{
print("Error: ");
print($_file . "could not be created \n");
exit;
}
else
{
file://$XMLcontent = $doc->dumpmem();
fputs($myFile, $doc->dumpmem());
fclose($myFile);
}
}
When i call the above function, the addition is done, but all on a single
line, and when the nodes are made on a single line, the rest of the
application is unable to access the information. Help.
We are on apache 1.3.19, PHP 4.0.4pl1 on a Linux box with redhat7.0. Kernel
2.2.16.
Help!
Dominique Paquin
galea secured networks
Quebec
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]