- Timestamp:
- 2019-11-29T23:40:14+13:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/metadata/MetadataXMLFile.java
r33727 r33730 35 35 import org.w3c.dom.*; 36 36 37 import org.greenstone.gatherer.util.Utility; 37 38 38 39 /** This class represents one metadata.xml file */ … … 262 263 String current_filename_element_value = XMLTools.getElementTextValue(current_filename_element); 263 264 264 String regexed_file_relative_path = MetadataTools.getRegularExpressionThatMatchesFilePath(file_relative_path); 265 //System.err.println("Looking in meta.xml for regexed version of filename: " + regexed_file_relative_path); 265 //System.err.println("\n Original TAIL filename was: " + Utility.debugUnicodeString(file.getName())); 266 String hexdecoded_regexed_file_relative_path = FilenameEncoding.decodeStringContainingHexEntities(file_relative_path); 267 //System.err.println("Looking in meta.xml for hexdecoded_regexed_file_RELATIVE_path: " + hexdecoded_regexed_file_relative_path 268 //+ " - debug version: " + Utility.debugUnicodeString(hexdecoded_regexed_file_relative_path)); 266 269 267 270 // Does this fileset specify metadata for one file only? … … 272 275 } 273 276 274 String current_filename_element_value_hex = FilenameEncoding.fileNameToHex(current_filename_element_value); 277 String hexdecoded_current_filename_element_value = FilenameEncoding.decodeStringContainingHexEntities(current_filename_element_value); 278 //System.err.println(" Checking to see if it matches " + hexdecoded_current_filename_element_value + " - debug: " + Utility.debugUnicodeString(hexdecoded_current_filename_element_value)); 279 //System.err.println(" Checking to see if it matches " + current_filename_element_value + " - debug: " + Utility.debugUnicodeString(current_filename_element_value)); 275 280 276 281 // This fileset specifies metadata for the file 277 // MetadataXMLFile.addMetadata(CollectionTreeNode, ArrayList) stored filename in uppercase hex, so need to compare with the same 278 if (file_relative_path.matches(current_filename_element_value_hex)) { //if (file_relative_path.matches(current_filename_element_value)) { 279 //System.err.println("Found a match in meta.xml for file name: " + regexed_file_relative_path); 282 // MetadataXMLFile.addMetadata(CollectionTreeNode, ArrayList) stored filename in uppercase hex 283 // so need to make sure everything hex has been decoded (no more hex) to compare apples with apples 284 if (hexdecoded_regexed_file_relative_path.matches(hexdecoded_current_filename_element_value)) { //if (file_relative_path.matches(current_filename_element_value)) { 285 //System.err.println(" @@@ Found a match in meta.xml for hexdecoded_regexed_file_relative_path: " + hexdecoded_regexed_file_relative_path); 280 286 current_fileset_matches = true; 281 287 if (!file_relative_path.equals("") && current_filename_element_value.equals(DIRECTORY_FILENAME)) { … … 283 289 } 284 290 break; 285 } 291 } //else { 292 //System.err.println( hexdecoded_regexed_file_relative_path + " does not match " + hexdecoded_current_filename_element_value); 293 //System.err.println( Utility.debugUnicodeString(hexdecoded_regexed_file_relative_path) + " does not match " + Utility.debugUnicodeString(hexdecoded_current_filename_element_value)); 294 //} 286 295 287 296 // This fileset specifies metadata for the folder the file is in 288 if ( regexed_file_relative_path.startsWith(current_filename_element_value + FilenameEncoding.URL_FILE_SEPARATOR)) {297 if (hexdecoded_regexed_file_relative_path.startsWith(hexdecoded_current_filename_element_value + FilenameEncoding.URL_FILE_SEPARATOR)) { 289 298 current_fileset_matches = true; 290 299 folder_metadata_inherited_from = new File(metadata_xml_file_directory, current_filename_element_value); … … 616 625 // If we have a file loaded into memory and it has been modified, save it now 617 626 if (loaded_file != null && loaded_file_changed == true) { 627 //System.err.println("START saveLoadedFile(), loaded_file_document:\n" + XMLTools.elementToString(loaded_file_document.getDocumentElement(), true)); 628 618 629 XMLTools.writeXMLFile(loaded_file, loaded_file_document, nonEscapingElements); 619 630 631 Document doc = XMLTools.parseXMLFile(loaded_file); 632 //System.err.println("AT END saveLoadedFile(), PARSED loaded_file contains:\n" + XMLTools.elementToString(doc.getDocumentElement(), true)); 620 633 621 634 loaded_file_changed = false;
Note:
See TracChangeset
for help on using the changeset viewer.