Bonjour tlm ! Le code suivant à partir des données receuillies d'un formulaire, permet de realiser la mise à jour d'un fichier XML existant. Alors sous mon serveur localhost WINNT ça marché Nikel. Par contre en utilsant le meme code sous Linux, je me suis rendu compte que l'exécution se bloque à $doc = new DOMDocument("1.0","UTF-8");. Ce serait un bien grand plaisir de recevoir votre assistance. Meilleures salutations public function updateXMLFile() { // create doctype echo 199999; $doc = new DOMDocument("1.0","UTF-8"); $doc->load('/home/tft/greenstone/collect/viprivattest/import/comm/metadata.xml'); //----------------------------------------------------------------------------------------------------------------------------- // Create a Child Element FileSet under DirectoryMetadata $FileSet=$doc->createElement("FileSet"); $doc->documentElement->appendChild($FileSet); // Create a Child Element Texte Node ( "") for FileSet $FileSetText=$doc->createTextNode(""); $FileSet->appendChild($FileSetText); //----------------------------------------------------------------------------------------------------------------------------- // Create a Child Element -> Child Element FileName $FileName=$doc->createElement("FileName"); $FileSet->appendChild($FileName); // Create a Child Element Texte Node $FileNameText=$doc->createTextNode($this->name);// $FileName->appendChild($FileNameText); //----------------------------------------------------------------------------------------------------------------------------- // Create a Child Element -> Child Element Description $Description=$doc->createElement("Description"); $FileSet->appendChild($Description); // Create a Child Element Texte Node $DescriptionText=$doc->createTextNode(""); $Description->appendChild($DescriptionText); //----------------------------------------------------------------------------------------------------------------------------- //for ($i=0;$i<count($this->content);$i++) { foreach ($this->meta as $key => $value) { // Create a Child Element -> Child Element-> Child Element $Metadata[$key]=$doc->createElement("Metadata"); $Description->appendChild($Metadata[$key]); // Create a Child Element Texte Node $MetadataText[$key]=$doc->createTextNode($value); $Metadata[$key]->appendChild($MetadataText[$key]); // create attribute node 1 $mode = $doc->createAttribute("mode"); $Metadata[$key]->appendChild($mode); // create attribute value node $modeValue = $doc->createTextNode("accumulate"); $mode->appendChild($modeValue); // create attribute node 2 $name = $doc->createAttribute("name"); $Metadata[$key]->appendChild($name); // create attribute value node $nameValue = $doc->createTextNode("vi.".$key); $name->appendChild($nameValue); } //----------------------------------------------------------------------------------------------------------------------------- //echo $doc->saveXML(); $order = $doc->save("Met.xml"); }
Please post your message in English. Chances that you find someone who speaks French, and knows the solution to whatever you're asking for are rather small. (I guess)
Bonjour tlm ! English This code, with data from a form, updates an XML file. The fact is that it's work properly under WINNT. But while using it under Linux the execution stops at $doc = new DOMDocument("1.0","UTF-8");. French Le code suivant à partir des données receuillies d'un formulaire, permet de realiser la mise à jour d'un fichier XML existant. Alors sous mon serveur localhost WINNT ça marché Nikel. Par contre en utilsant le meme code sous Linux, je me suis rendu compte que l'exécution se bloque à $doc = new DOMDocument("1.0","UTF-8");. Ce serait un bien grand plaisir de recevoir votre assistance. Meilleures salutations public function updateXMLFile() { // create doctype echo 199999; $doc = new DOMDocument("1.0","UTF-8"); $doc->load('/home/tft/greenstone/collect/viprivattest/import/comm/metadata.xml'); //----------------------------------------------------------------------------------------------------------------------------- // Create a Child Element FileSet under DirectoryMetadata $FileSet=$doc->createElement("FileSet"); $doc->documentElement->appendChild($FileSet); // Create a Child Element Texte Node ( "") for FileSet $FileSetText=$doc->createTextNode(""); $FileSet->appendChild($FileSetText); //----------------------------------------------------------------------------------------------------------------------------- // Create a Child Element -> Child Element FileName $FileName=$doc->createElement("FileName"); $FileSet->appendChild($FileName); // Create a Child Element Texte Node $FileNameText=$doc->createTextNode($this->name);// $FileName->appendChild($FileNameText); //----------------------------------------------------------------------------------------------------------------------------- // Create a Child Element -> Child Element Description $Description=$doc->createElement("Description"); $FileSet->appendChild($Description); // Create a Child Element Texte Node $DescriptionText=$doc->createTextNode(""); $Description->appendChild($DescriptionText); //----------------------------------------------------------------------------------------------------------------------------- //for ($i=0;$i<count($this->content);$i++) { foreach ($this->meta as $key => $value) { // Create a Child Element -> Child Element-> Child Element $Metadata[$key]=$doc->createElement("Metadata"); $Description->appendChild($Metadata[$key]); // Create a Child Element Texte Node $MetadataText[$key]=$doc->createTextNode($value); $Metadata[$key]->appendChild($MetadataText[$key]); // create attribute node 1 $mode = $doc->createAttribute("mode"); $Metadata[$key]->appendChild($mode); // create attribute value node $modeValue = $doc->createTextNode("accumulate"); $mode->appendChild($modeValue); // create attribute node 2 $name = $doc->createAttribute("name"); $Metadata[$key]->appendChild($name); // create attribute value node $nameValue = $doc->createTextNode("vi.".$key); $name->appendChild($nameValue); } //----------------------------------------------------------------------------------------------------------------------------- //echo $doc->saveXML(); $order = $doc->save("Met.xml"); }[/QUOTE]
Hi Are you using php 5 on the linux box. The php website implies that DOMDocument is only available in php 5 - http://uk.php.net/dom Brew
Can you put the following code into a file and send me the link to it please (PM if you prefer) <?php phpinfo(); ?> PHP: Brew
Hi B ! I'm now working on a server with a private IP. But what I can see while consulting PHPInfo on both WINNT and Linux Servers is that the last one do not have DOM extension what can may be explain the fact of none working. Do you know please how to update it so that it'll get DOM extension ? Thanks