Changeset 7373


Ignore:
Timestamp:
12/09/10 08:22:06 (9 years ago)
Author:
melissa
Message:

Sanitize XML before parsing and prevent XML parsing failures from causing setId to fail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/NikonElementsTiffReader.java

    r6823 r7373  
    9292    String xml = ifds.get(0).getIFDTextValue(NIKON_XML_TAG); 
    9393    xml = "<NIKON>" + xml.substring(xml.indexOf("<")) + "</NIKON>"; 
     94    xml = XMLTools.sanitizeXML(xml); 
    9495 
    9596    handler = new ND2Handler(core); 
    96     XMLTools.parseXML(xml, handler); 
    97  
    98     Hashtable<String, Object> globalMetadata = handler.getMetadata(); 
    99     for (String key : globalMetadata.keySet()) { 
    100       addGlobalMeta(key, globalMetadata.get(key)); 
    101     } 
     97    try { 
     98      XMLTools.parseXML(xml, handler); 
     99 
     100      Hashtable<String, Object> globalMetadata = handler.getMetadata(); 
     101      for (String key : globalMetadata.keySet()) { 
     102        addGlobalMeta(key, globalMetadata.get(key)); 
     103      } 
     104    } 
     105    catch (IOException e) { } 
    102106  } 
    103107 
Note: See TracChangeset for help on using the changeset viewer.