Author: sevein
Date: Thu Dec 15 16:10:03 2011
New Revision: 10412

Log:
Update code to load new METS.xml filename which now includes the SIP UUID

Modified:
   
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php

Modified: 
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
==============================================================================
--- 
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
    Thu Dec 15 16:06:54 2011        (r10411)
+++ 
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
    Thu Dec 15 16:10:03 2011        (r10412)
@@ -137,7 +137,26 @@
 
   protected function process()
   {
-    $this->document = new 
SimpleXMLElement(@file_get_contents($this->filename.DIRECTORY_SEPARATOR.'METS.xml'));
+    // Find METS file
+    if ($handle = opendir($this->filename))
+    {
+      while (false !== $entry = readdir($handle))
+      {
+        if (0 < preg_match('/^METS\..*\.xml$/', $entry))
+        {
+          $this->document = new 
SimpleXMLElement(@file_get_contents($this->filename.DIRECTORY_SEPARATOR.$entry));
+        
+          break;
+        }
+      }
+
+      closedir($handle);
+    }
+
+    if (!isset($this->document))
+    {
+      throw new sfException('METS.xml file was not found.');
+    }
 
     // Main object
     if (null != ($dmdSec = $this->getMainDmdSec()))

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to