Answering my own question (I'm not as lost as I thought I would be), I found that getting the root node returns an array with an element for each line of the message. I iterated through the array and concatenated the first 3 characters of each line (since all of the segment headers are 3 characters long) and separated the strings with a comma to make it easier to read.
var strList = '';
var hl7Segments = source.getAllNodes('/');
for (var iter = 0; iter < hl7Segments.length; iter++){
strList+=hl7Segments[iter].substring(0,3)+',';
}
strList = strList.length>0?StringUtils.stripEnd(strList, ','):'';