Witam, mam taki problem, otoz pisze aplikacje w Javie, bedaca komunikatorem sieciowym, ktory pobiera liste aktywnych serwerow z strony ww jako plik XML. Jezeli jakis serwer sie chce dopisac do listy to wywoluje funkcje napisana w php, ktora dopisuje go do listy. Niestety cos nie dziala i nie mam pojecia dlaczego, nie wyswietla zadnych bledow. Tworzenie pustej listy jak i wêz³a z serwerem dzia³a wporzadku, wysypuje sie na dodawaniu do listy (funkcja addServer()). Oto kod (zak³adamy, ¿e ¿adna lista nie istnieje):

  1. <?
  2.  error_reporting(E_ALL);
  3.  
  4. // constants
  5.  
  6. define(ENCODING, 'iso-8859-2');
  7. define(XML_VERSION, '1.0');
  8.  
  9. // creates empty jNivo Server List (jNsl)
  10. function createServerList($filename, $owner)
  11. {
  12. $dom = new DOMDocument(XML_VERSION, ENCODING);
  13. $root = $dom->createElement('serverList','');
  14. $root->setAttribute('creationDate', date("r")); // RFC 822 date format 
  15. $root->setAttribute('owner', $owner);
  16. $root->setAttribute('link', __FILE__);
  17. $dom->appendChild($root);
  18. $result = $dom->save($filename);
  19. if($result==false)
  20. {
  21. return "ERROR: Cannot create file.";
  22.  }
  23. else
  24. {
  25. return "Created file at " . $filename . " - " . $result . " bytes.";
  26. }
  27. }
  28.  
  29. // creates jNivo server node 
  30. function createServerNode($name, $description, $ip, $country, $language, $webmaster)
  31. {
  32. $dom = new DOMDocument(XML_VERSION, ENCODING);
  33. $root = $dom->createElement('server','');
  34. $root->setAttribute('name', $name);
  35. $root->setAttribute('description', $description);
  36. $root->setAttribute('country', $country);
  37. $root->setAttribute('language', $language);
  38. $root->setAttribute('webmaster', $webmaster);
  39. $root->setAttribute('ip', $ip);
  40. return $root;
  41. }
  42.  
  43. // adds Server node to server list
  44. function addServer($serverNode, $serverListFile)
  45. {
  46.  
  47. $dom = new DOMDocument(XML_VERSION, ENCODING);
  48. $dom->load($serverListFile);
  49.  
  50. //print_r($serverListFile);
  51.  
  52. $serverList = $dom->getElementsByTagName("serverList");
  53. $server = $serverList->item(0);
  54. $server->appendChild($serverNode);
  55.  
  56. //print_r($server);
  57. //print_r($serverListFile);
  58.  
  59. $result = $dom->save($serverListFile);
  60.  
  61. if($result==false)
  62. {
  63. return "ERROR: Cannot append server.";
  64.  }
  65. else
  66. {
  67. return "Server appended at " . $serverListFile . "";
  68. }
  69.  
  70. }
  71.  
  72. //------------------------------------------------------------------------------------------
  73. echo createServerList('testList.xml', 'WPodgorski');
  74. $node = createServerNode('Server1', 'TesT', '0.0.0.0', 'USA', 'en-us', 'webmaster@aol.com');
  75. echo addServer($node, "testList.xml");
  76. ?>


Prosze pomozcie mi, poniewaz to czesc projetku ktory musze oddac w czwartek winksmiley.jpg, pozdrawiam i dzieki za pomoc!