web stats
parse through each HL7 segment as an independent XML - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-24-2015, 09:32 AM
gkittlaus gkittlaus is offline
OBX.3 Kenobi
 
Join Date: Jan 2012
Posts: 104
gkittlaus is on a distinguished road
Default 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:

Quote:
<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
Quote:
MSH
I tried so many possibilities like ".id" or ".tagName" but it I don't get it to work.

best regards
Reply With Quote
  #2  
Old 06-24-2015, 09:51 AM
mcalKno mcalKno is offline
 
Join Date: Apr 2015
Location: Pennsylvania
Posts: 247
mcalKno is on a distinguished road
Default

Code:
for each (seg in msg.children()) {
	segxml = new XML(seg)
	logger.info(seg.name().toString())				
}
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:12 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation