Hi, I simulated the example in Hapi website to convert ER7 to XML. But
something wrong happened in xml format.(UNKNOWN element in xml)
I use Hapi-0.5.1. The code is as follows: 
public String convertHL7ToXML(String hl7encodedtraditionalmsg) throws
EncodingNotSupportedException,HL7Exception{
      PipeParser pipeparser = new PipeParser();
        Message hapimsg ;
        String hl7encodedxmlmsg = null;
      DefaultXMLParser xmlParser = new DefaultXMLParser();
      hapimsg = pipeparser.parse(hl7encodedtraditionalmsg);
      hl7encodedxmlmsg = xmlParser.encode(hapimsg);
      return hl7encodedxmlmsg;
        }

then,in the main function, do this:
hl7encodedtraditionalmsg="MSH|^~\\&|HIS|RIH|EKG|EKG|199904140038||ADT^A01||P|2.2\r"
                +
"PID|0001|00009874|00001122|A00977|SMITH^JOHN^M|MOM|19581119|F|NOTREAL^LINDA^M|C|564
SPRING
ST^^NEEDHAM^MA^02494^US|0002|(818)565-1551|(425)828-3344|E|S|C|0000444444|252-00-4414||||SA|||SA||||NONE|V1|0001|I|D.ER^50A^M110^01|ER|P00055|11B^M011^02|070615^BATMAN^GEORGE^L|555888^NOTREAL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^NOTREAL^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|199904101200||||5555112333|||666097^NOTREAL^MANNY^P\r"
                + "NK1|0222555|NOTREAL^JAMES^R|FA|STREET^OTHER
STREET^CITY^ST^55566|(222)111-3333|(888)999-0000|||||||ORGANIZATION\r"
                +
"PV1|0001|I|D.ER^1F^M950^01|ER|P000998|11B^M011^02|070615^BATMAN^GEORGE^L|555888^OKNEL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^VOICE^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|||||5555112333|||666097^DNOTREAL^MANNY^P\r"
                + "PV2|||0112^TESTING|55555^PATIENT IS
NORMAL|NONE|||19990225|19990226|1|1|TESTING|555888^NOTREAL^BOB^K^DR^MD||||||||||PROD^003^099|02|ER||NONE|19990225|19990223|19990316|NONE\r"
                + "AL1||SEV|001^POLLEN\r"
                + "GT1||0222PL|NOTREAL^BOB^B||STREET^OTHER
STREET^CITY^ST^77787|(444)999-3333|(222)777-5555||||MO|111-33-5555||||NOTREAL
GILL N|STREET^OTHER STREET^CITY^ST^99999|(111)222-3333\r"
                + "IN1||022254P|4558PD|BLUE CROSS|STREET^OTHER
STREET^CITY^ST^00990||(333)333-6666||221K|LENIX|||19980515|19990515|||PATIENT01
TEST D||||||||||||||||||02LL|022LP554";

The result is :
............................................................
<PID.37>
            <UNKNOWN.1>11B</UNKNOWN.1>
            <UNKNOWN.2>M011</UNKNOWN.2>
            <UNKNOWN.3>02</UNKNOWN.3>
</PID.37>
<PID.38>
            <UNKNOWN.1>070615</UNKNOWN.1>
            <UNKNOWN.2>BATMAN</UNKNOWN.2>
            <UNKNOWN.3>GEORGE</UNKNOWN.3>
            <UNKNOWN.4>L</UNKNOWN.4>
</PID.38>
................................................................
I want to know why there are some  "UNKNOWN.1" element in the xml . 
Thanks in advance! =)

-----
Just Do It !
-- 
View this message in context: 
http://www.nabble.com/%22UNKNOWN%22-element-appear-when-converting-ER7-to-XML-by-using-Hapi-tp23251841p23251841.html
Sent from the hl7api-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to