Hi Leo, sometimes the message structure in HL7 is ambiguous if you omit required segments. In this case(QUERY_RESPONSE group) if you need the group you need to set the PID and PV1. Not sure if this solves the error, anyhow the message parsing without the required segments is error prone
Leo-61 wrote: > > Hello to everybody! I dont know if it is a well-know bug. Imagine, for > example, ADR_A19/QUERY_RESPONSE standard v.25 group, that contains these > elements: > EVN > PID > PD1 > *ROL* > NK1 > ... > *ROL* > ... > > > ROL segment appears 2 times in the group. In first place, if you want use > a > terser to set the values of ROL segment you should do: > t.set("/QUERY_RESPONSE/NK1-1", "1"); > t.set("/QUERY_RESPONSE/*ROL*(0)-1", "vale1"); //first ocurrence > first repetition > t.set("/QUERY_RESPONSE/*ROL*(1)-1", "value2"); //first ocurrence > second repetition > t.set("/QUERY_RESPONSE/*ROL2*(0)-1", "value3"); //second > ocurrence > first repetitition > t.set("/QUERY_RESPONSE/*ROL2*(1)-1", "value4"); /second ocurrence > second repetition > > Note that you use ROL to refer first segment ocurrence (not first > repetition) and ROL2 for second. It is no documented in Terser class, but > this (ROL2, ROL3, ROL4...) names are asigned in insert() metod of > AbstractGroup class when is inserted a segment or group with existent > name. > This generate a XML QUERY_RESPONSE like: > > <ADR_A19.QUERY_RESPONSE> > <EVN/> > <*ROL*> > <ROL.1> > <EI.1>*value1*</EI.1> > </ROL.1> > </ROL> > <*ROL*> > <ROL.1> > <EI.1>*value2*</EI.1> > </ROL.1> > </ROL> > <*NK1*> > <NK1.1>1</NK1.1> > </NK1> > <*ROL*> > <ROL.1> > <EI.1>*value3*</EI.1> > </ROL.1> > </ROL> > <*ROL*> > <ROL.1> > <EI.1>*value4*</EI.1> > </ROL.1> > </ROL> > </ADR_A19.QUERY_RESPONSE> > > > > The problem is when you want to parse this xml message to hapi classes. > XMLParser is confused when find 4 ROL segments in the QUERY_RESPONSE > group, > and cant parse it correctly, getting this QUERY_RESPONSE: > > <ADR_A19.QUERY_RESPONSE> > <EVN/> > <ROL> > <ROL.1> > <EI.1>*value1*</EI.1> > </ROL.1> > </ROL> > <ROL> > <ROL.1> > <EI.1>*value2*</EI.1> > </ROL.1> > </ROL> > <ROL> > <ROL.1> > <EI.1>*value3*</EI.1> > </ROL.1> > </ROL> > <ROL> > <ROL.1> > <EI.1>*value4*</EI.1> > </ROL.1> > </ROL> > <NK1> > <NK1.1>1</NK1.1> > </NK1> > <ROL> > <ROL.1> > <EI.1>*value1*</EI.1> > </ROL.1> > </ROL> > <ROL> > <ROL.1> > <EI.1>*value2*</EI.1> > </ROL.1> > </ROL> > <ROL> > <ROL.1> > <EI.1>*value3*</EI.1> > </ROL.1> > </ROL> > <ROL> > <ROL.1> > <EI.1>*value4*</EI.1> > </ROL.1> > </ROL> > </ADR_A19.QUERY_RESPONSE> > > > It is really a bug? Or iam doing something wrong? > > Thanks a lot. > Leo. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Hl7api-devel mailing list > Hl7api-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > -- View this message in context: http://www.nabble.com/Posible-BUG-when-messages-or-groups-have-duplicated-elements-tf4832294.html#a13910063 Sent from the hl7api-devel mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Hl7api-devel mailing list Hl7api-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hl7api-devel