Skip to content

Commit 0395a03

Browse files
authored
Merge pull request #239 from NASA-PDS/copilot/sub-pr-238
Address feedback on JSON extraction for citation metadata
2 parents 6f84269 + cb9bdb8 commit 0395a03

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

harvest-legacy/src/main/java/gov/nasa/pds/harvest/search/util/XMLExtractor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.io.StringWriter;
55
import java.util.ArrayList;
66
import java.util.List;
7+
import java.util.logging.Logger;
78

89
import javax.xml.transform.sax.SAXSource;
910
import javax.xml.xpath.XPathConstants;
@@ -25,6 +26,9 @@
2526
* Class to extract data from an XML file.
2627
*/
2728
public class XMLExtractor {
29+
/** Logger instance */
30+
private static final Logger log = Logger.getLogger(XMLExtractor.class.getName());
31+
2832
/** The DOM source. */
2933
private DocumentInfo xml = null;
3034

@@ -339,7 +343,7 @@ public List<String> getValuesAsJsonFromItem(String expression, Object item)
339343
throw e;
340344
} catch (Exception e) {
341345
// If conversion fails, log and skip this node
342-
System.err.println("Warning: Failed to convert XML node to JSON: " + e.getMessage());
346+
log.warning("Failed to convert XML node to JSON: " + e.getMessage());
343347
}
344348
}
345349
}

0 commit comments

Comments
 (0)