XML assistance needed. XML will not parse…

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf XML assistance needed. XML will not parse…

  • Creator
    Topic
  • #54718
    Mike Wilson
    Participant

      I am hoping someone with XML knowledge can help me out here.  I am getting nowhere.  I could not get an XSD from our other vendor so I am in limbo creating my own.  It compiles but wont parse any messages.  Attached are the XML message I am getting from the vendor and the XSD i created.  

      It is failing with ” Erro generated during parsing. – Unknown element ‘insertPatientHL7RecResponse’

      Code:























      Code:

      MSH|^~&|||ADM|SITE|20150608000000||ACK|Therapute|P|2.6
      MSA|AA|77258863

    Viewing 4 reply threads
    • Author
      Replies
      • #82698
        Levy Lazarre
        Participant

          Mike,

          Did you get this problem resolved? I see a couple of issues with the XSD. Perhaps you already have a fix.

        • #82699
          Mike Wilson
          Participant

            Levy Lazarre wrote:

            Mike,

            Did you get this problem resolved? I see a couple of issues with the XSD. Perhaps you already have a fix.

            No I have not gotten it fixed.  If you have some insight I would appreciate it.

          • #82700
            Levy Lazarre
            Participant

              Mike,

              The XML parser is having trouble with namespaces in the data:

              1. In the XSD declaration, you have the attribute

              Code:


              elementFormDefault=”qualified”

              This tells the parser that every element in the XML files will be prefixed with a namespace qualifier. This is not the case in your sample; elements “insertPatientHL7RecResponse” and “insertPatientHL7RecResult” are not prefixed.

              2. You also have the attribute

              Code:


              targetNamespace=”http://www.w3.org/2003/05/soap-envelope”

              This tells the parser that every element will be contained in the “soap” namespace. However, in the sample XML file, the vendor resets the namespace of the element “insertPatientHL7RecResponse” to the default namespace by appending the attribute xmlns=”website here” to it. Since the parser is looking in the “soap” namespace, this element is not found, hence the error message you are getting.

              If you want to still use your XSD, you can simply modify the XML files with an inbound TPS, removing the default namespace assignment and adding the missing “soap:”prefix to the elements. The following corrected sample should work fine for you:

              Code:


               
                 
                   MSH|^~&|||ADM|SITE|20150608000000||ACK|Therapute|P|2.6 MSA|AA|77258863
                 
               

              It took just 3 “regsub” commands to modify the sample. It would be a very short TPS for you to create, unless you can get the vendor to modify their output.

              I hope this helps.

            • #82701
              Levy Lazarre
              Participant

                Mike,

                I have another suggestion for you. If you don’t mind using a DTD instead of an XSD, then you wouldn’t have to modify the XML files.

                You should create a New Package/Folder in Server Package Viewer and place the following DTD in there (sample.dtd):

                Code:


                When you compile the DTD, make sure to select soap:Envelope as the Root element. You can then test with your original XML sample and it should work fine.

              • #82702
                Mike Wilson
                Participant

                  Larry,

                  Thank you very much.  This is the first XML dealings I have had so I was a bit lost.  I appreciate your help.  I am going to try and get it working today.  What I had done was write a proc to get the HL7 ack out of the message to not worry about the XML.  But I want to get it working fully.  Thank you again.

                  MIke

              Viewing 4 reply threads
              • The forum ‘Cloverleaf’ is closed to new topics and replies.