Changeset 6143
- Timestamp:
- 2003-12-08T14:17:38+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/msm/GreenstoneArchiveParser.java
r6051 r6143 97 97 // Retrieve the DOM of the file. 98 98 Document document = Utility.parse(file, false); 99 100 Gatherer.println("Parsed greenstone archive document: " + file.getAbsolutePath()); 99 101 // If we successfully parsed the document, then it is time to search through the DOM for the Metadata tags. 100 102 if(document != null) { … … 103 105 // Retrieve all of the Metadata sections. 104 106 NodeList metadata_elements = archive_element.getElementsByTagName("Metadata"); 107 // We first zip through the retrieved metadata, and if we encounter the element 'SourceSegment' - a sure sign this collection came from a bibliographic type file - we break out of extracted metadata parsing as no sense could be made of the data extracted anyway (plus we suffer a death of thirty-thousand pointy bits of metadata!) 108 for(int i = 0; i < metadata_elements.getLength(); i++) { 109 Element metadata_element = (Element) metadata_elements.item(i); 110 String name = metadata_element.getAttribute("name"); 111 if(name.equalsIgnoreCase(StaticStrings.SOURCESEGMENT_VALUE)) { 112 return 0; 113 } 114 } 105 115 // Now for each Metadata entry retrieved... 106 116 for(int i = 0; i < metadata_elements.getLength(); i++) { 107 117 Element metadata_element = (Element) metadata_elements.item(i); 108 118 String name = metadata_element.getAttribute("name"); 109 // There is a special case when the metadata name is gsdlsourcefilename, as we use this to find the FileRecord we want to add metadata to.119 // There is also a special case when the metadata name is gsdlsourcefilename, as we use this to find the FileRecord we want to add metadata to. 110 120 if(name.equals("gsdlsourcefilename")) { 111 121 file_path = MSMUtils.getValue(metadata_element);
Note:
See TracChangeset
for help on using the changeset viewer.