Hi,

Executing  getXMLMsgAsPIPED with the  two strings below, returns a piped 
message when the  variable messageXML2 is used but not when messageXML1 used.  
I've shortened down the variables in this example so it's just to illustrate.

Questions

-          Do the xml string need to be structured

-          If it needs to be structured how to structure it when I come in as 
in variable messageXML1

-Tommy

          public String getXMLMsgAsPIPED(String message, String 
messageStructure) throws HL7Exception {
                  System.out.println("Inside getXMLMsgAsPIPED : "+message+"\n");
                  String xmlMessage = message;

                  DefaultXMLParser XParser = new DefaultXMLParser();
                  PipeParser classicParser = new PipeParser();
                  String classicMessage = null;
                      ca.uhn.hl7v2.parser.XMLParser xmlParser = new 
DefaultXMLParser();
                      try{

                          ca.uhn.hl7v2.model.Message msg = 
xmlParser.parse(xmlMessage);

                          classicMessage = classicParser.encode(msg);
                          System.out.println("Inside getXMLMsgAsPIPED 
classicMessage : "+classicMessage+"\n");

                              System.out.println("Output classicMessage : 
"+classicMessage+"\n");
                          return classicMessage;
                      }
                      catch (Exception e) {
                          e.printStackTrace();
                          return "0";

                      }
                  return classicMessage;
          }



String messageXML1 = "<ADT_A01 xmlns:ns0=\"urn:hl7-org:v2xml\" 
xmlns=\"urn:hl7-org:v2xml\"><ns0:MSH><ns0:MSH.1>|</ns0:MSH.1><ns0:MSH.2>^~\\&amp;</ns0:MSH.2>....."
VS
String messageXML2 = <?xml version=\"1.0\"?>\n" +
        "<ADT_A01 xmlns=\"urn:hl7-org:v2xml\">\n" +
        "    <MSH>\n" +
        "        <MSH.1>|</MSH.1>\n" +
        "        <MSH.2>^~\\&amp;</MSH.2>\n" +
        "        <MSH.3>\n" +
        "            <HD.1>YSY</HD.1>\n" +
        "        </MSH.3>\n" +
        "        <MSH.4>\n" +
        "            <HD.1>WSY</HD.1>\n"+
       "         ..............";

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to