Пример #1
0
        public void ParseORFR04ToXmlNoOCR()
        {
            string message = @"MSH|^~\&|Query Result Locator|Query Facility Name|Query Application Name|ST ELSEWHERE HOSPITAL|20051024074506||ORF^R04|432|P|2.3|
MSA|AA|123456789|
QRD|20060228160421|R|I||||10^RD&Records&0126|38923^^^^^^^^&TCH|||
QRF||20050101000000||
PID|||38923^^^ST ELSEWHERE HOSPITAL Medical Record Numbers&              MEDIC              AL RECORD NUMBER&ST ELSEWHERE HOSPITAL^MR^ST ELSEWHERE HOSPITAL||Bombadill^Tom||19450605|M|||1&Main Street^^Littleton^CO^80122||^^^^^303^4376329^22|
OBR|1|0015566|DH2211223|83036^HEMOGLOBIN A1C^^83036^HEMOGLOBIN A1C|||20040526094000|||||||20040526094000||J12345^JENS^JENNY^^^DR^MD^^^^^^^112233&TCH|||||          TP QUEST DIAGNOSTICS-TAMPA 4225 E. FOWLER AVE TAMPA          FL 33617|20030622070400|||F|
OBX|1|NM|50026400^HEMOGLOBIN A1C^^50026400^HEMOGLOBIN A1C||12|^% TOTAL HGB|4.0 - 6.0|H|||F|||20040510094000|TP^^L|";

            ca.uhn.hl7v2.parser.PipeParser parser = new ca.uhn.hl7v2.parser.PipeParser();

            ca.uhn.hl7v2.model.Message m = parser.parse(message);

            ca.uhn.hl7v2.model.v23.message.ORF_R04 orfR04 = m as ca.uhn.hl7v2.model.v23.message.ORF_R04;

            Assert.IsNotNull(orfR04);

            ca.uhn.hl7v2.parser.XMLParser xmlParser = new ca.uhn.hl7v2.parser.DefaultXMLParser();

            string recoveredMessage = xmlParser.encode(orfR04);

            Assert.IsNotNull(recoveredMessage);
            Assert.IsFalse(recoveredMessage.IndexOf("ORC") > -1, "Returned message added ORC segment.");
        }
Пример #2
0
        public void ParseORFR04ToXmlNoNTE()
        {
            string message = @"MSH|^~\&|Query Result Locator|Query Facility Name|Query Application Name|ST ELSEWHERE HOSPITAL|20051024074506||ORF^R04|432|P|2.3|
            MSA|AA|123456789|
            QRD|20060228160421|R|I||||10^RD&Records&0126|38923^^^^^^^^&TCH|||
            QRF||20050101000000||
            PID|||38923^^^ST ELSEWHERE HOSPITAL Medical Record Numbers&              MEDIC              AL RECORD NUMBER&ST ELSEWHERE HOSPITAL^MR^ST ELSEWHERE HOSPITAL||Bombadill^Tom||19450605|M|||1&Main Street^^Littleton^CO^80122||^^^^^303^4376329^22|
            OBR|1|0015566|DH2211223|83036^HEMOGLOBIN A1C^^83036^HEMOGLOBIN A1C|||20040526094000|||||||20040526094000||J12345^JENS^JENNY^^^DR^MD^^^^^^^112233&TCH|||||          TP QUEST DIAGNOSTICS-TAMPA 4225 E. FOWLER AVE TAMPA          FL 33617|20030622070400|||F|
            OBX|1|NM|50026400^HEMOGLOBIN A1C^^50026400^HEMOGLOBIN A1C||12|^% TOTAL HGB|4.0 - 6.0|H|||F|||20040510094000|TP^^L|";

            ca.uhn.hl7v2.parser.PipeParser parser = new ca.uhn.hl7v2.parser.PipeParser();

            ca.uhn.hl7v2.model.Message m = parser.parse(message);

            ca.uhn.hl7v2.model.v23.message.ORF_R04 orfR04 = m as ca.uhn.hl7v2.model.v23.message.ORF_R04;

            Assert.IsNotNull(orfR04);

            ca.uhn.hl7v2.parser.XMLParser xmlParser = new ca.uhn.hl7v2.parser.DefaultXMLParser();

            string recoveredMessage = xmlParser.encode(orfR04);

            Assert.IsNotNull(recoveredMessage);
            Assert.IsFalse(recoveredMessage.IndexOf("NTE")>-1, "Returned message added ORC segment.");
        }
Пример #3
0
 public void ConvertToDate()
 {
     DateTime checkDate = DateTime.Now;
     PipeParser parser = new PipeParser();
     ADT_A01 a01 = new ADT_A01();
     a01.PV1.TransferToBadDebtDate.Set(checkDate);
     Assert.AreEqual(a01.PV1.TransferToBadDebtDate.Value, checkDate.ToString("yyyyMMdd"));
 }
Пример #4
0
        public void ParseQRYR02()
        {
            string message = @"MSH|^~\&|CohieCentral|COHIE|Clinical Data Provider|TCH|20060228155525||QRY^R02^QRY_R02|1|P|2.3|
QRD|20060228155525|R|I||||10^RD&Records&0126|38923^^^^^^^^&TCH|||";

            ca.uhn.hl7v2.parser.PipeParser parser = new ca.uhn.hl7v2.parser.PipeParser();

            ca.uhn.hl7v2.model.Message m = parser.parse(message);

            ca.uhn.hl7v2.model.v23.message.QRY_R02 qryR02 = m as ca.uhn.hl7v2.model.v23.message.QRY_R02;

            Assert.IsNotNull(qryR02);
            Assert.AreEqual("38923", qryR02.QRD.getWhoSubjectFilter(0).IDNumber.Value);
        }
Пример #5
0
        public static new void Main(System.String[] args)
        {
            if (args.Length != 1)
            {
                System.Console.Out.WriteLine("Usage: DefaultXMLParser pipe_encoded_file");
                System.Environment.Exit(1);
            }

            //read and parse message from file
            try
            {
                System.IO.FileInfo messageFile = new System.IO.FileInfo(args[0]);
                long fileLength = SupportClass.FileLength(messageFile);
                //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                System.IO.StreamReader r = new System.IO.StreamReader(messageFile.FullName, System.Text.Encoding.Default);
                char[] cbuf = new char[(int) fileLength];
                //UPGRADE_TODO: Method 'java.io.Reader.read' was converted to 'System.IO.StreamReader.Read' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioReaderread_char[]'"
                System.Console.Out.WriteLine("Reading message file ... " + r.Read((System.Char[]) cbuf, 0, cbuf.Length) + " of " + fileLength + " chars");
                r.Close();
                System.String messString = System.Convert.ToString(cbuf);

                Parser inParser = null;
                Parser outParser = null;
                PipeParser pp = new PipeParser();
                ca.uhn.hl7v2.parser.XMLParser xp = new DefaultXMLParser();
                System.Console.Out.WriteLine("Encoding: " + pp.getEncoding(messString));
                if (pp.getEncoding(messString) != null)
                {
                    inParser = pp;
                    outParser = xp;
                }
                else if (xp.getEncoding(messString) != null)
                {
                    inParser = xp;
                    outParser = pp;
                }

                Message mess = inParser.parse(messString);
                System.Console.Out.WriteLine("Got message of type " + mess.GetType().FullName);

                System.String otherEncoding = outParser.encode(mess);
                System.Console.Out.WriteLine(otherEncoding);
            }
            catch (System.Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
            }
        }
Пример #6
0
        public void ParseORFR04()
        {
            string message = @"MSH|^~\&|Query Result Locator|Query Facility Name|Query Application Name|ST ELSEWHERE HOSPITAL|20051024074506||ORF^R04|432|P|2.3|
            MSA|AA|123456789|
            QRD|20060228160421|R|I||||10^RD&Records&0126|38923^^^^^^^^&TCH|||
            QRF||20050101000000||
            PID|||38923^^^ST ELSEWHERE HOSPITAL Medical Record Numbers&              MEDIC              AL RECORD NUMBER&ST ELSEWHERE HOSPITAL^MR^ST ELSEWHERE HOSPITAL||Bombadill^Tom||19450605|M|||1&Main Street^^Littleton^CO^80122||^^^^^303^4376329^22|
            OBR|1|0015566|DH2211223|83036^HEMOGLOBIN A1C^^83036^HEMOGLOBIN A1C|||20040526094000|||||||20040526094000||J12345^JENS^JENNY^^^DR^MD^^^^^^^112233&TCH|||||          TP QUEST DIAGNOSTICS-TAMPA 4225 E. FOWLER AVE TAMPA          FL 33617|20030622070400|||F|
            OBX|1|NM|50026400^HEMOGLOBIN A1C^^50026400^HEMOGLOBIN A1C||12|^% TOTAL HGB|4.0 - 6.0|H|||F|||20040510094000|TP^^L|";

            ca.uhn.hl7v2.parser.PipeParser parser = new ca.uhn.hl7v2.parser.PipeParser();

            ca.uhn.hl7v2.model.Message m = parser.parse(message);

            ca.uhn.hl7v2.model.v23.message.ORF_R04 orfR04 = m as ca.uhn.hl7v2.model.v23.message.ORF_R04;
            Assert.IsNotNull(orfR04);
            Assert.AreEqual("12", orfR04.getQUERY_RESPONSE().getORDER().getOBSERVATION().OBX.getObservationValue()[0].Data.ToString());
        }
Пример #7
0
        public void ParseXMLToHL7()
        {
            string message = GetQRYR02XML();

            ca.uhn.hl7v2.parser.XMLParser xmlParser = new ca.uhn.hl7v2.parser.DefaultXMLParser();
            ca.uhn.hl7v2.model.Message    m         = xmlParser.parse(message);

            ca.uhn.hl7v2.model.v23.message.QRY_R02 qryR02 = m as ca.uhn.hl7v2.model.v23.message.QRY_R02;

            Assert.IsNotNull(qryR02);

            ca.uhn.hl7v2.parser.PipeParser pipeParser = new ca.uhn.hl7v2.parser.PipeParser();

            string pipeOutput = pipeParser.encode(qryR02);

            Assert.IsNotNull(pipeOutput);
            Assert.IsFalse(string.Empty.Equals(pipeOutput));
        }
Пример #8
0
        public void ParseORFR04()
        {
            string message = @"MSH|^~\&|Query Result Locator|Query Facility Name|Query Application Name|ST ELSEWHERE HOSPITAL|20051024074506||ORF^R04|432|P|2.3|
MSA|AA|123456789|
QRD|20060228160421|R|I||||10^RD&Records&0126|38923^^^^^^^^&TCH|||
QRF||20050101000000||
PID|||38923^^^ST ELSEWHERE HOSPITAL Medical Record Numbers&              MEDIC              AL RECORD NUMBER&ST ELSEWHERE HOSPITAL^MR^ST ELSEWHERE HOSPITAL||Bombadill^Tom||19450605|M|||1&Main Street^^Littleton^CO^80122||^^^^^303^4376329^22|
OBR|1|0015566|DH2211223|83036^HEMOGLOBIN A1C^^83036^HEMOGLOBIN A1C|||20040526094000|||||||20040526094000||J12345^JENS^JENNY^^^DR^MD^^^^^^^112233&TCH|||||          TP QUEST DIAGNOSTICS-TAMPA 4225 E. FOWLER AVE TAMPA          FL 33617|20030622070400|||F|
OBX|1|NM|50026400^HEMOGLOBIN A1C^^50026400^HEMOGLOBIN A1C||12|^% TOTAL HGB|4.0 - 6.0|H|||F|||20040510094000|TP^^L|";

            ca.uhn.hl7v2.parser.PipeParser parser = new ca.uhn.hl7v2.parser.PipeParser();

            ca.uhn.hl7v2.model.Message m = parser.parse(message);

            ca.uhn.hl7v2.model.v23.message.ORF_R04 orfR04 = m as ca.uhn.hl7v2.model.v23.message.ORF_R04;
            Assert.IsNotNull(orfR04);
            Assert.AreEqual("12", orfR04.getQUERY_RESPONSE().getORDER().getOBSERVATION().OBX.getObservationValue()[0].Data.ToString());
        }
Пример #9
0
 public AnonymousClassPredicate1(System.String name, PipeParser enclosingInstance)
 {
     InitBlock(name, enclosingInstance);
 }
Пример #10
0
 private void InitBlock(PipeParser enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
Пример #11
0
 public AnonymousClassPredicate(PipeParser enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Пример #12
0
 public AnonymousClassPredicate(PipeParser enclosingInstance)
 {
     InitBlock(enclosingInstance);
 }
Пример #13
0
 private void  InitBlock(System.String name, PipeParser enclosingInstance)
 {
     this.name = name;
     this.enclosingInstance = enclosingInstance;
 }
Пример #14
0
 public AnonymousClassPredicate1(System.String name, PipeParser enclosingInstance)
 {
     InitBlock(name, enclosingInstance);
 }
Пример #15
0
 private void  InitBlock(PipeParser enclosingInstance)
 {
     this.enclosingInstance = enclosingInstance;
 }
Пример #16
0
 private void InitBlock(System.String name, PipeParser enclosingInstance)
 {
     this.name = name;
     this.enclosingInstance = enclosingInstance;
 }
Пример #17
0
        public static void Main(System.String[] args)
        {
            if (args.Length != 1)
            {
                System.Console.Out.WriteLine("Usage: XMLParser pipe_encoded_file");
                System.Environment.Exit(1);
            }

            //read and parse message from file
            try
            {
                PipeParser parser = new PipeParser();
                System.IO.FileInfo messageFile = new System.IO.FileInfo(args[0]);
                long fileLength = SupportClass.FileLength(messageFile);
                //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                System.IO.StreamReader r = new System.IO.StreamReader(messageFile.FullName, System.Text.Encoding.Default);
                char[] cbuf = new char[(int) fileLength];
                //UPGRADE_TODO: Method 'java.io.Reader.read' was converted to 'System.IO.StreamReader.Read' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioReaderread_char[]'"
                System.Console.Out.WriteLine("Reading message file ... " + r.Read((System.Char[]) cbuf, 0, cbuf.Length) + " of " + fileLength + " chars");
                r.Close();
                System.String messString = System.Convert.ToString(cbuf);
                Message mess = parser.parse(messString);
                System.Console.Out.WriteLine("Got message of type " + mess.GetType().FullName);

                ca.uhn.hl7v2.parser.XMLParser xp = new AnonymousClassXMLParser();

                //loop through segment children of message, encode, print to console
                System.String[] structNames = mess.Names;
                for (int i = 0; i < structNames.Length; i++)
                {
                    Structure[] reps = mess.getAll(structNames[i]);
                    for (int j = 0; j < reps.Length; j++)
                    {
                        if (typeof(Segment).IsAssignableFrom(reps[j].GetType()))
                        {
                            //ignore groups
                            //UPGRADE_TODO: Class 'javax.xml.parsers.DocumentBuilder' was converted to 'System.Xml.XmlDocument' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxxmlparsersDocumentBuilder'"
                            //UPGRADE_ISSUE: Method 'javax.xml.parsers.DocumentBuilderFactory.newInstance' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxxmlparsersDocumentBuilderFactory'"
                            //DocumentBuilderFactory.newInstance();

                            System.Xml.XmlDocument docBuilder = new System.Xml.XmlDocument();
                            //UPGRADE_TODO: Class 'javax.xml.parsers.DocumentBuilder' was converted to 'System.Xml.XmlDocument' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxxmlparsersDocumentBuilder'"
                            System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); //new doc for each segment
                            System.Xml.XmlElement root = doc.CreateElement(reps[j].GetType().FullName);
                            doc.AppendChild(root);
                            xp.encode((Segment) reps[j], root);
                            System.IO.StringWriter out_Renamed = new System.IO.StringWriter();
                            System.Console.Out.WriteLine("Segment " + reps[j].GetType().FullName + ": \r\n" + doc.OuterXml);

                            System.Type[] segmentConstructTypes = new System.Type[]{typeof(Message)};
                            System.Object[] segmentConstructArgs = new System.Object[]{null};
                            Segment s = (Segment) reps[j].GetType().GetConstructor(segmentConstructTypes).Invoke(segmentConstructArgs);
                            xp.parse(s, root);
                            //UPGRADE_TODO: Class 'javax.xml.parsers.DocumentBuilder' was converted to 'System.Xml.XmlDocument' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxxmlparsersDocumentBuilder'"
                            System.Xml.XmlDocument doc2 = new System.Xml.XmlDocument();
                            System.Xml.XmlElement root2 = doc2.CreateElement(s.GetType().FullName);
                            doc2.AppendChild(root2);
                            xp.encode(s, root2);
                            System.IO.StringWriter out2 = new System.IO.StringWriter();
                            System.Xml.XmlTextWriter ser = new System.Xml.XmlTextWriter(out2);

                            //System.Xml.XmlWriter ser = System.Xml.XmlWriter.Create(out2);
                            doc.WriteTo(ser);
                            if (out2.ToString().Equals(out_Renamed.ToString()))
                            {
                                System.Console.Out.WriteLine("Re-encode OK");
                            }
                            else
                            {
                                System.Console.Out.WriteLine("Warning: XML different after parse and re-encode: \r\n" + out2.ToString());
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
            }
        }
Пример #18
0
        public void ParseQRYR02()
        {
            string message = @"MSH|^~\&|CohieCentral|COHIE|Clinical Data Provider|TCH|20060228155525||QRY^R02^QRY_R02|1|P|2.3|
            QRD|20060228155525|R|I||||10^RD&Records&0126|38923^^^^^^^^&TCH|||";

            ca.uhn.hl7v2.parser.PipeParser parser = new ca.uhn.hl7v2.parser.PipeParser();

            ca.uhn.hl7v2.model.Message m = parser.parse(message);

            ca.uhn.hl7v2.model.v23.message.QRY_R02 qryR02 = m as ca.uhn.hl7v2.model.v23.message.QRY_R02;

            Assert.IsNotNull(qryR02);
            Assert.AreEqual("38923", qryR02.QRD.getWhoSubjectFilter(0).IDNumber.Value);
        }
Пример #19
0
        public static void  Main(System.String[] args)
        {
            if (args.Length != 1)
            {
                System.Console.Out.WriteLine("Usage: XMLParser pipe_encoded_file");
                System.Environment.Exit(1);
            }

            //read and parse message from file
            try
            {
                PipeParser         parser      = new PipeParser();
                System.IO.FileInfo messageFile = new System.IO.FileInfo(args[0]);
                long fileLength = SupportClass.FileLength(messageFile);
                //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                System.IO.StreamReader r = new System.IO.StreamReader(messageFile.FullName, System.Text.Encoding.Default);
                char[] cbuf = new char[(int)fileLength];
                //UPGRADE_TODO: Method 'java.io.Reader.read' was converted to 'System.IO.StreamReader.Read' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioReaderread_char[]'"
                System.Console.Out.WriteLine("Reading message file ... " + r.Read((System.Char[])cbuf, 0, cbuf.Length) + " of " + fileLength + " chars");
                r.Close();
                System.String messString = System.Convert.ToString(cbuf);
                Message       mess       = parser.parse(messString);
                System.Console.Out.WriteLine("Got message of type " + mess.GetType().FullName);

                ca.uhn.hl7v2.parser.XMLParser xp = new AnonymousClassXMLParser();

                //loop through segment children of message, encode, print to console
                System.String[] structNames = mess.Names;
                for (int i = 0; i < structNames.Length; i++)
                {
                    Structure[] reps = mess.getAll(structNames[i]);
                    for (int j = 0; j < reps.Length; j++)
                    {
                        if (typeof(Segment).IsAssignableFrom(reps[j].GetType()))
                        {
                            //ignore groups
                            //UPGRADE_TODO: Class 'javax.xml.parsers.DocumentBuilder' was converted to 'System.Xml.XmlDocument' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxxmlparsersDocumentBuilder'"
                            //UPGRADE_ISSUE: Method 'javax.xml.parsers.DocumentBuilderFactory.newInstance' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxxmlparsersDocumentBuilderFactory'"
                            //DocumentBuilderFactory.newInstance();

                            System.Xml.XmlDocument docBuilder = new System.Xml.XmlDocument();
                            //UPGRADE_TODO: Class 'javax.xml.parsers.DocumentBuilder' was converted to 'System.Xml.XmlDocument' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxxmlparsersDocumentBuilder'"
                            System.Xml.XmlDocument doc  = new System.Xml.XmlDocument();                            //new doc for each segment
                            System.Xml.XmlElement  root = doc.CreateElement(reps[j].GetType().FullName);
                            doc.AppendChild(root);
                            xp.encode((Segment)reps[j], root);
                            System.IO.StringWriter out_Renamed = new System.IO.StringWriter();
                            System.Console.Out.WriteLine("Segment " + reps[j].GetType().FullName + ": \r\n" + doc.OuterXml);

                            System.Type[]   segmentConstructTypes = new System.Type[] { typeof(Message) };
                            System.Object[] segmentConstructArgs  = new System.Object[] { null };
                            Segment         s = (Segment)reps[j].GetType().GetConstructor(segmentConstructTypes).Invoke(segmentConstructArgs);
                            xp.parse(s, root);
                            //UPGRADE_TODO: Class 'javax.xml.parsers.DocumentBuilder' was converted to 'System.Xml.XmlDocument' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaxxmlparsersDocumentBuilder'"
                            System.Xml.XmlDocument doc2  = new System.Xml.XmlDocument();
                            System.Xml.XmlElement  root2 = doc2.CreateElement(s.GetType().FullName);
                            doc2.AppendChild(root2);
                            xp.encode(s, root2);
                            System.IO.StringWriter   out2 = new System.IO.StringWriter();
                            System.Xml.XmlTextWriter ser  = new System.Xml.XmlTextWriter(out2);

                            //System.Xml.XmlWriter ser = System.Xml.XmlWriter.Create(out2);
                            doc.WriteTo(ser);
                            if (out2.ToString().Equals(out_Renamed.ToString()))
                            {
                                System.Console.Out.WriteLine("Re-encode OK");
                            }
                            else
                            {
                                System.Console.Out.WriteLine("Warning: XML different after parse and re-encode: \r\n" + out2.ToString());
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
            }
        }
Пример #20
0
        public void ParseXMLToHL7()
        {
            string message = GetQRYR02XML();

            ca.uhn.hl7v2.parser.XMLParser xmlParser = new ca.uhn.hl7v2.parser.DefaultXMLParser();
            ca.uhn.hl7v2.model.Message m = xmlParser.parse(message);

            ca.uhn.hl7v2.model.v23.message.QRY_R02 qryR02 = m as ca.uhn.hl7v2.model.v23.message.QRY_R02;

            Assert.IsNotNull(qryR02);

            ca.uhn.hl7v2.parser.PipeParser pipeParser = new ca.uhn.hl7v2.parser.PipeParser();

            string pipeOutput = pipeParser.encode(qryR02);

            Assert.IsNotNull(pipeOutput);
            Assert.IsFalse(string.Empty.Equals(pipeOutput));
        }