Source for file XMLAssetIterator.class.php

Documentation is available at XMLAssetIterator.class.php

  1. <?php
  2. /**
  3. * @since 7/20/05
  4. * @package polyphony.repository_importer
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: XMLAssetIterator.class.php,v 1.8 2007/09/19 14:04:48 adamfranco Exp $
  10. */
  11.  
  12. require_once(DOMIT);
  13.  
  14. /**
  15. * <##>
  16. *
  17. * @since 7/20/05
  18. * @package polyphony.repository_importer
  19. *
  20. * @copyright Copyright &copy; 2005, Middlebury College
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22. *
  23. * @version $Id: XMLAssetIterator.class.php,v 1.8 2007/09/19 14:04:48 adamfranco Exp $
  24. */
  25. class XMLAssetIterator
  26. extends HarmoniIterator
  27. {
  28. /**
  29. * Constructor
  30. *
  31. * @param String $sourceDirectory
  32. * @param object $parentRepositoryImporter
  33. * @return object
  34. * @access public
  35. * @since 7/20/05
  36. */
  37. function XMLAssetIterator ($srcDir, $parentRepositoryImporter) {
  38. $import = new DOMIT_Document();
  39. if ($import->loadXML($srcDir."metadata.xml")) {
  40. if (!($import->documentElement->hasChildNodes()))
  41. $parentRepositoryImporter->addError("There are no assets to import in: ".$srcDir."metadata.xml.");
  42.  
  43. $this->_assetList =$import->documentElement->childNodes;
  44. $this->_current = 0;
  45. }
  46. else
  47. $parentRepositoryImporter->addError("XML parse failed: ".$srcDir."metadata.xml does not exist or contains poorly formed XML.");
  48. }
  49. /**
  50. * checks if the next element exists
  51. *
  52. * @return boolean
  53. * @access public
  54. * @since 7/20/05
  55. */
  56. function hasNext () {
  57. if ($this->_current < count($this->_assetList))
  58. return true;
  59. else
  60. return false;
  61. }
  62. /**
  63. * returns the next element
  64. *
  65. * @return object DOMIT_Node
  66. * @access public
  67. * @since 7/20/05
  68. */
  69. function next() {
  70. $temp =$this->_assetList[$this->_current];
  71. $this->_current++;
  72. return $temp;
  73. }
  74. }
  75.  
  76. ?>

Documentation generated on Wed, 19 Sep 2007 10:28:30 -0400 by phpDocumentor 1.3.0RC3