XML to HL7

  • Creator
    Topic
  • #49994
    Jeannette Wistrom
    Participant

      I am trying to translate an XML message into HL7.  I am getting the following error:

      [0:TEST] Error generated during parsing. – Datatype error: Type:InvalidDatatypeValueException, Message:The unary operation node had a binary node type. – Line 1, Col 510

      Can anyone tell me what this means?

      Thanks in advance….

    Viewing 15 reply threads
    • Author
      Replies
      • #64425
        Ryan Spires
        Participant

          Jeannette,

          XML can be finicky at best… Not sure if I can answer your question as to what the error means (other than it appears that the data that is coming in an associated tag does not match the datatype of the tag)…

          With that said… I generally just use string as the datatype for every tag…

          Though this may not be ideal, it has worked in my very limited use of XML through the engine and generally once converted to format needed, the original datatype is not important anyway.

          Not sure if that helps, but if you change a block of tags (saving out your original) you may be able to find the culprit by process of elimination.

        • #64426
          Jeannette Wistrom
          Participant

            Thanks Ryan…I will try that out and see what happens and let you know.

          • #64427
            Robert Milfajt
            Participant

              For your XML, what type of encoding are you using.  I had a problem going from HL7->XML because there were control characters in the HL7 that were not acceptable to the default XML encoding type, utf-8, but when I changed it to iso-8859-1, everything was fine.

              Hope this helps,

              Robert Milfajt
              Northwestern Medicine
              Chicago, IL

            • #64428
              Jeannette Wistrom
              Participant

                I am using the utf-8, I will try converting it to your suggestion and see what happens….thanks.

              • #64429
                Jeannette Wistrom
                Participant

                  Well I changed it to iso-8859-1 and am still getting the same error.  I wish I knew what the error meant.  But thanks for all the suggestions.

                • #64430
                  Kevin Kinnell
                  Participant

                    It means that the XML parser thought that it was performing an operation that would be using a single node and got a node that was a multiple.  What the nodes were is the big question.

                    The way the XML specs talk about ‘nodes’ is a pain; your “unary operation node” is a great example.  EVERYthing is a node.  You’d think that humans had nothing better to do than parse XML and keep track of where they are in some abstract syntax tree.  It appears that something was being parsed that resulted in the parser expecting some ‘single node’ (maybe a tag without attributes) but it got a tree of some sort instead.

                    I’d try to go out to character 510 of the input file and figure out what the parser thinks it’s looking at at that point.

                    What Cloverleaf version are you working with?

                  • #64431
                    Jeannette Wistrom
                    Participant

                      We are on 5.4.1.  How do you count the columns in XML?  Is it the actual data or does it include the tags?

                    • #64432
                      Kevin Kinnell
                      Participant

                        Caveat: I haven’t worked with the Cloverleaf XML yet, and I don’t have access to a 5.4x system.  That said…

                        I’d count characters, especially since it’s the first line.  My guess would be “first line” means “first line after the root element”.

                        I’d almost bet there is an extraneous ‘<' character in your input.  That could cause the kind of parser error you're seeing.  If the lexer reports that a tag is opening, and the parser is a validating parser, it's possible that the parser would decide there was an extra node where none was expected. Also, I just noticed this thread: https://usspvlclovertch2.infor.com/viewtopic.php?t=2498” class=”bbcode_url”>https://usspvlclovertch2.infor.com/viewtopic.php?t=2498

                        From what Charlie says the error is coming from the schema, so you can find out what the parser was expecting by counting into the schema, but you’ll have to eyeball the input to find the bad data.  I’d still guess it’s an “un-entified” less-than, though.

                      • #64433
                        Jeannette Wistrom
                        Participant

                          I am using XMLSpy and it has validated my schema.  I changed everything to ENGINE=”xs:string” and that took care of that error.  Now I am getting:

                          Element “OrderingPhysicianID” is not valid for content model: ”((AppointmentID,Patient,TechnologistID,Technologist,StressorID,Stressor,OrderingPhysicianID,OrderingPhysician,ReferringID,Referring,ReadingPhysicianID,ReadingPhysician,Date_x0020_Of_x0020_Test,Location,Status,NoShow,TestType),ReferringPhysicianID)’ – Line 1, Col 711

                          This is never ending….and why is everyone in such a hurry to implement XML?

                        • #64434
                          Jeannette Wistrom
                          Participant

                            I am including my schema in case you want to take a look.  I had to change the ext to .txt, but it should be .xsd

                          • #64435
                            Ryan Spires
                            Participant

                              Jeannette,

                              The next thing to look for is to make sure that your data is consistant with your schema,   Check your data file to make sure that every tag is present and that it is in the correct order with correct spelling… One thing I have done to make it a little more functional and error resistant is to add minOccurs=0 to the tag defininition… This won’t fix wrong order, but if a tag is missing as some apps will not send an empty tag.

                              check out this website for more details…  I have found it to be very helpful.

                              http://www.w3schools.com/xml/default.asp

                            • #64436
                              Kevin Kinnell
                              Participant

                                C’mon now…XML is much better than … um …  . . .  X12 maybe?  ðŸ™„

                                Well, anyway.

                                I see that the type for CPI is unsignedInt, not string, so you might want to look at that in a bit.

                                The schema shows that the spGetCardioSchedule element is expecting a sequence of tags.  If my memory serves me correctly it wants all of those tags in the order specified with none of them missing (I’ll be checking this and get back with the answer, but I think that’s what the xsd means.)

                                Is the OrderingPhysicianID element in the wrong position?

                              • #64437
                                Jeannette Wistrom
                                Participant

                                  Thanks to both of you.  I didn’t catch the CPI type, but will correct it now.  So the data must be in the same order that the elements are.  The data I am using is actually from an hl7 message that I did a translation on with this schema.  It produces the xml file, but I can’t get it to go the other way and create an hl7 message.

                                  Ryan, where are you located now?  I haven’t talked to you since you left LabCorp…..

                                • #64438
                                  Kevin Kinnell
                                  Participant

                                    Not necessarily–you can make XMLschema allow it in any order but I think you lose the ability to prevent duplicate tags, your spGetPersons element ought to work that way.

                                    sigh.  I have barely worked with XMLSchema (I use RelaxNG and DTDs mostly) and its been more than a year since I did anything serious with XML.  I’m getting tired of saying “I seem to recall” and “I’m pretty sure that”–I guess it’s time to brush up on W3C-ish stuff.

                                  • #64439
                                    Art Schwartz
                                    Participant

                                      II am seeing the following error message when trying to compile an XML to HL7 Xlate

                                      Command: hcixlttest cardiodx_idxrad_oru.xlt


                                      FAILED


                                      [0:TEST] Error loading XML Definition. – Unable to resolve the namespace of root element – ns1:ChlXmlExport

                                      [0:TEST] Can’t get record definition for ‘xml Cardio ChlXmlExport ns1:ChlXmlExport’.

                                      [0:TEST] Unable to compile XLT ‘cardiodx_idxrad_oru.xlt’.

                                      The frustrating part of this is that the exact same schema is used in the HL7 to XML Xlate that is other half of this bi-directional interface and it compiles cleanly. Is CL more fussy on inbound XML then it is on Outbound XML?

                                      I suspect that when I am using the XML package manager I am not choosing the correct option in the namespace and/or options panels

                                      Any help would be appreciated

                                    • #64440
                                      Ryan Spires
                                      Participant

                                        Art,

                                        I am sure there may be a better way to do this, so others, please feel free to respond…

                                        But in the meantime… one thing that I have done is make sure that my root tag looks like the following

                                        http://www.w3.org/2001/XMLSchema&#8220;>

                                         

                                        as the first three lines… seems to load up ok..

                                        Ryan

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