Hi. I have a question that concernes this piece of code:
public static void main(final String[] args0) {
String adta28 =
"MSH|^~\\&|LIS|XYZ|KJH|YTR|20120119121356.5840+0100||ADT^A28|HL7Gtw0134F5AC4B6800|P|2.5\r"+
"EVN|A28|20120119121333||||20120119121333\r"+
"PID|1||2001458280^^^^LIS||PROVA^PROVA\r"+
"PV1|1|N";
Parser p = new GenericParser();
Message message;
try {
message = p.parse(adta28);
System.out.println("before: "+p.encode(message));
Terser terser = new Terser(message);
String one = terser.get("/.PID-3(1)-1");
String two = terser.get("/.PID-3(2)-1");
System.out.println("after: "+p.encode(message));
} catch (Exception e) {
e.printStackTrace();
}
}
This is the output of the above code:
before:
MSH|^~\&|LIS|XYZ|KJH|YTR|20120119121356.5840+0100||ADT^A28|HL7Gtw0134F5AC4B6800|P|2.5
EVN|A28|20120119121333||||20120119121333
PID|1||2001458280^^^^LIS||PROVA^PROVA
PV1|1|N
after:
MSH|^~\&|LIS|XYZ|KJH|YTR|20120119121356.5840+0100||ADT^A28|HL7Gtw0134F5AC4B6800|P|2.5
EVN|A28|20120119121333||||20120119121333
PID|1||2001458280^^^^LIS~~||PROVA^PROVA
PV1|1|N
Why is the PID-3 different in the 'after 'output? I
do terser.get operations on null repetitions and I would expect the PID-3
in the message not to change.
But the message changes. I get two extra ~.
Is there a workaround to do the get-operations
and leave the message unmodified?
Thanks a lot.
Lorenzo Michelutti
Ps. I use v0.6 but it's the same with v1.2
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel