Announcement

Collapse
No announcement yet.

parse through each HL7 segment as an independent XML

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • parse through each HL7 segment as an independent XML

    Hi,

    I try to parse through each HL7 Segment seperatly. Therefor I built a loop like this:

    Code:
    for each (seg in msg.children()) {
    	segxml = new XML(seg)
    	logger.info(segxml.tagName)				
    }
    anyway, all I want to read now is the segment name.
    If Í only print the segxml, I get this:

    <MSH><MSH.1>|</MSH.1><MSH.2>^~\&amp;</MSH.2><MSH.3><MSH.3.1>HIS</MSH.3.1></MSH.3><MSH.4><MSH.4.1>MedCenter</MSH.4.1></MSH.4><MSH.5><MSH.5.1>LIS</MSH.5.1></MSH.5><MSH.6><MSH.6.1>MedCenter</MSH.6.1></MSH.6><MSH.7><MSH.7.1>20060307110114</MSH.7.1></MSH.7><MSH.8/><MSH.9><MSH.9.1>ORM</MSH.9.1><MSH.9.2>O01</MSH.9.2></MSH.9><MSH.10><MSH.10.1>MSGID20060307110114</MSH.10.1></MSH.10><MSH.11><MSH.11.1>P</MSH.11.1></MSH.11><MSH.12><MSH.12.1>2.3</MSH.12.1></MSH.12></MSH>
    What I simply wnat to check is the segment name, so my Output should simply be
    MSH
    I tried so many possibilities like ".id" or ".tagName" but it I don't get it to work.

    best regards

  • #2
    Code:
    for each (seg in msg.children()) {
    	segxml = new XML(seg)
    	logger.info(seg.name().toString())				
    }

    Comment

    Working...
    X