[XML-SIG] Help parsing XML

Greg Lindstrom greg.lindstrom at novasyshealth.com
Tue Mar 29 23:33:13 CEST 2005

I have a general (I guess) xml parsing question that I hope has an 
answer.  I am busy parsing health care claim records using xpath and do 
not see a way to parse the following (stripped down) file (I've added 
lines to group my problem...)

1.  + <seg id='ST'>
2.  + <loop id='HEADER'>
3.  - <loop id='DETAIL'>
4.    - <loop id='2000A'>
5.      + <seg id='HL'>
6.      + <loop id='2000AA'>
7.      + <loop id='2000B'>
8.        + <seg id='HL'>   --------+
9.        + <seg id='SBR'>          |
10.       + <loop id='2010BA'>      | Group 1
11.       + <loop id='2010BB'>      |
12.       + <loop id='2300'>   -----+
13.       + <seg id='HL'>  ---------+
14.       + <seg id='SBR'>          |
15.       + <loop id='2010BA'>      |
16.       + <loop id='2010BB'>      | Group 2
17.       + <loop id='2300'>   -----+
18.               </loop>
19.           </loop>
20.       </loop>

What I need to do is process the records from lines 8-12 as a group, 
then the records from lines 13-17 as another group.  Each of the "HL" 
segments indicates the beginning of a new set of records to process.  I 
would think that the xml should (would/could) be defined so that each of 
the HL statements would start a new loop structure, but that's not how 
it's defined and I can't change it.  There is no way of knowing how many 
lines will be in each set of records, or how many HL segments will be 
beneath the 2000B loop, so is there a way I can logically group the 
record segments together to form a packet of record to process?

Thanks for any attention/help you can pass my way.


Greg Lindstrom               501 975.4859 (office)
Senior Programmer            501 219-4455 (fax)
NovaSys Health               greg.lindstrom at novasyshealth.com
Little Rock, Arkansas

"We are the music makers, and we are the dreamers of dreams."  W.W.

Confidentiality Notice
This email and any attachments to it are privileged and confidential and are intended solely for use of the individual or entity to which they are addressed. If the reader of this message is not the intended recipient, any use, distribution, or copying of this communication, or disclosure of all or any part of its content to any other person, is strictly prohibited. If you have received this communication in error, please notify the sender by replying to this message and destroy this message and delete any copies held in your electronic files. Thank you.

More information about the XML-SIG mailing list