/class/class.xmlcreator.php

http://freshdns.googlecode.com/ · PHP · 48 lines · 37 code · 8 blank · 3 comment · 2 complexity · a110f117f785293ec477da2718259079 MD5 · raw file

  1. <?
  2. class xmlcreator {
  3. var $content;
  4. function __construct ()
  5. {
  6. $this->content = "";
  7. }
  8. function __destruct ()
  9. {
  10. unset($this->content);
  11. }
  12. function addHeader()
  13. {
  14. //header('Content-Type: application/xml');
  15. $this->content .= "<?xml version=\"1.0\"?>\n";
  16. }
  17. function addTag ($tagName, $tagLevel)
  18. {
  19. // ADD THE TABS
  20. for($i=0; $i<$tagLevel; $i++)
  21. {
  22. $this->content .= "\t";
  23. }
  24. $this->content .= "<".$tagName.">\n";
  25. }
  26. function addItem ($tagName, $tagContent, $tagLevel)
  27. {
  28. // ADD THE TABS
  29. for($i=0; $i<$tagLevel; $i++)
  30. {
  31. $this->content .= "\t";
  32. }
  33. $this->content .= "<".$tagName.">".$tagContent."</".$tagName.">\n";
  34. }
  35. function returnContent ()
  36. {
  37. return $this->content;
  38. }
  39. }
  40. ?>