Changeset 6639
- Timestamp:
- 2004-01-28T14:47:07+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/msm/GreenstoneArchiveParser.java
r6539 r6639 108 108 String file_path = null; 109 109 Element archive_element = document.getDocumentElement(); 110 // Retrieve the initial Section element 111 NodeList section_elements = archive_element.getElementsByTagName(StaticStrings.SECTION_ELEMENT); 112 // It may be the case that we have some sort of mutant freak archive file which doesn't have any section elements. 113 if(section_elements.getLength() < 1) { 114 return count; 115 } 116 Element section_element = (Element) section_elements.item(0); 117 section_elements = null; 110 118 // Retrieve all of the Metadata sections. 111 NodeList metadata_elements = archive_element.getElementsByTagName("Metadata"); 119 NodeList metadata_elements = section_element.getElementsByTagName(StaticStrings.METADATA_ELEMENT); 120 section_element = null; 112 121 // 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!) 113 122 for(int i = 0; i < metadata_elements.getLength(); i++) { 114 123 Element metadata_element = (Element) metadata_elements.item(i); 115 String name = metadata_element.getAttribute( "name");124 String name = metadata_element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 116 125 if(name.equalsIgnoreCase(StaticStrings.SOURCESEGMENT_VALUE)) { 117 126 return 0; … … 121 130 for(int i = 0; i < metadata_elements.getLength(); i++) { 122 131 Element metadata_element = (Element) metadata_elements.item(i); 123 String name = metadata_element.getAttribute( "name");132 String name = metadata_element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 124 133 // 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. 125 134 if(name.equals("gsdlsourcefilename")) {
Note:
See TracChangeset
for help on using the changeset viewer.