locked
XML with HL7 RRS feed

  • Question

  • User1122355199 posted

    Hello everyone and thanks for your help in advance.  I am entering a new project that involves the transmission of HL7 messages.  I understand HL7 very well and have previously hand coded many interfaces with various vendors.  I want to get a better understanding of the various parsers and message builders, open source and otherwise that are out there as well as the https://www.hl7.org/fhir/index.htmlFHIR standards that are evolving.  At the heart of my question is the use of XML with XSD for these standards.  To preface my question, I know and deal very little with XML and none with XSD, so I am very uniformed about the uses of these technologies.  I understand the parsing of inbound, hierarchical data, such as an HL7 message, makes perfect sense for XML given it is also hierarchical data.  But I don't understand how or why to use XML and XSD to generate an outbound, HL7 message.  In some of my basic applications, I have utilized a class library I developed to generate these messages.  But obviously, there are more sophisticated ways of doing this and I need to understand how these work before proceeding with which parsers to use.  Any help or insight into my questions would be greatly appreciated.

    Saturday, December 24, 2016 5:16 PM

Answers

  • User475983607 posted

    kmcnet

    Again, I appreciate the response, but we're not communicating and the question is not answered in my mind.  I know there is no direct conversion.  However, there is a reason XML and XSD is being used instead of class libraries.  Why?

    XML/XSD is platform agnostic. The use of XML is just the way technology went.  You'll also see HL7 in JSON format.

    kmcnet

    Next question.  The XSD files that I have been scolded for posting do not parse using the .Net XSD converter, even though the XSD files were downloaded from the HL7.org site.  So there is something wrong with the parser or the XSD files are wrong.  Neither explanation seems to make sense.  So either I'm not understanding how to convert these files, or the XSD/XML approach is a cul-de-sac not worth pursuing.

    I'm not sure what the problem is but briefly reading the readme.txt file on the HL7.org site indicates there are a known issues with the schema files.  The XSDs are open source files. It is up to you to determine if the files are of any value.  Have you considered contacting the HL7.org support? Likewise there are .NET compatible XSD parsers on the Internet if you feel xsd.exe is not working properly.

    kmcnet

    So if I understand, you don't work directly with XSD files, but need to convert them into either a class library, or apply them to an XML file.  Am I understanding and if not, PLEASE explain.

    An XSD file is like an empty SQL table; the Data Definition Logic (DDL).  If you have data and wish to store the data in a database, you need to build a table.  The table schema has constraints like the column named ID is an integer.  The same concept applies to an XSD.  

    Let's assume you writing an XML service and you want everyone using your service to adhere to a certain data interface.  You give all the clients an XSD (the schema) and tell the clients to use the XSD to format the data properly.  When a client sends XML to the service. the service validates the XML against the XSD.  If the XML passes validation then the data is processed.  Otherwise, the validation fails, the service rejects the XML, and service tells the client what validation rule fired. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 31, 2016 7:46 PM

All replies

  • User-1838255255 posted

    Hi Kmcnet,

    But I don't understand how or why to use XML and XSD to generate an outbound, HL7 message.

    According to your description, as far as I know, you need know the function of the XSD, The first function is support data type, the second function is can protected data communication. For more function, please refer to this link:

    http://www.w3schools.com/Xml/schema_intro.asp

    HL7 message is need it to regulate, like regulate work with data from database, convert type between different types of data.

    Best Regards,

    Eric Du

    Monday, December 26, 2016 6:45 AM
  • User1122355199 posted

    Thanks for the response.  On a high level basis, I do understand the roles of XSD.  What started my question was looking at components like HL7.Net to generate outbound HL7 messages.  The project lacks documentation, so I began looking at the source to see if I could get a better understanding and see that virtually every class works off of an XML/XSD schema.  Like I said earlier, I understand why you would use this for an inbound HL7 message, but unclear as to why it would be used, instead of a class library, to generate the outbound HL7 message.  As an aside, I never really figured out how the HL7.Net project works.

    Monday, December 26, 2016 12:55 PM
  • User1122355199 posted

    Here is my question rephrased.  The HL7 standards located at https://www.hl7.org/implement/standards/product_brief.cfm?product_id=214provide downloadable XML and XSD, but I really don't know what to do with these.  Would someone be able to get me pointed in the right direction? 

    Monday, December 26, 2016 4:08 PM
  • User475983607 posted

    XML is a self describing data.  XSD is the schema, it describes the structure of the XML.

    XML/XSD is very mature in .NET.  There are a lot of tutorials and documentation.  What exactly are you struggling with?

    https://msdn.microsoft.com/en-us/library/182eeyhh(v=vs.110).aspx

    http://www.w3schools.com/Xml/schema_intro.asp

    Tuesday, December 27, 2016 2:14 PM
  • User1122355199 posted

    Thank you for the response.  I think the first article may be helpful after I really understand them.  Like I said earlier, I am working with HL7 files and have, in the past hand rolled class libraries for the application.  Tedious I know, but sometimes, granular control of these objects.  However, I realize for extensibility, this is a bad idea.  So I looked at some of the open source parsers and see everything is based on an XML document model, which I have very little background in.  Since I don't understand what these parsers are doing, I don't know how to effectively use them and am terrified of them in a production situation.  So the HL7 site has schema files that I pulled down, but don't know what to do with them.  So from the very little I read, I think you are telling me an XML document can be generated from the XSD.  From there, you use the XML document similar to a class library to build the individual segments of the HL7 message.  Am I starting to follow the logic?

    Tuesday, December 27, 2016 4:04 PM
  • User475983607 posted

    I worked with HL7.  HL7 is a protocol for communicating between Health Information Systems (HIS).

    XML is a self defining data using markup language and XSD is the definition language for XML.  It very common for system service endpoints to send XML content since it travels well over the wire and most languages have classes that handle XML quite well.

    Given your experience with HL7 I would assume that when you look at an HL7 related XSD or even the XML it look very familiar and you see the rules in the schema.    

    So from the very little I read, I think you are telling me an XML document can be generated from the XSD. 

    No, XML is the data and XSD is the schema as stated above.  XSD is like a table definition in SQL and XML is like a comma separated values (CSV).  You can look at the data and get an idea of what it is but without the schema you would have to make an assumption on the types and such.

    Like everything in technology, if you want to know more about XML and XSD then I take some time to go through a few tutorials.  Once you have a handle on the technology you should be able to translate that to HL7.

    Tuesday, December 27, 2016 5:47 PM
  • User1122355199 posted

    Again, thanks for the response, and I will (and have been looking through tutorials).  Yes, the XSD does look familiar, but here is where I am hung up (and maybe shouldn't be).  If I am supplied only with the XSD, I would still need the XML document to make things work.  So can I generate an XML document using an XSD (I think I can, but am still back at the starting gate with this).  And do I need a DTD as well?

    Tuesday, December 27, 2016 6:27 PM
  • User475983607 posted

    If I am supplied only with the XSD, I would still need the XML document to make things work.

    Correct.  The XSD is used to build the object and validate the XML.

    So can I generate an XML document using an XSD (I think I can, but am still back at the starting gate with this).

    For the third time, XSD (XML Schema Definition) defines the structure of the XML.  I suppose you could generate an empty XML document, an XML document that is void of data and only contains elements.

    https://msdn.microsoft.com/en-us/library/ms255824.aspx

    And do I need a DTD as well?

    Not if you are using an XSD.

    A common scenario is your are given an XSD and told here is the interface to expect.  Since you have the data structure (XSD) you can build classes (object model) to hold the data. At some point you are sent the data (XML) where you can use the XSD to validate the XML and populate the object model.

    Wednesday, December 28, 2016 11:18 AM
  • User1122355199 posted

    Again, thank you for your response and your patience.  I do understand (each of the three times) that XSD is the schema definition, however, I am hung up on the generation or parsing of the actual HL7 document.  Here is an example.  Let's start off with a snippet of an XSD:

    <!--
            SEGMENT PID
        -->
        <xsd:complexType name="PID.CONTENT">
            <xsd:sequence>
                <xsd:element ref="PID.1" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.2" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.3" minOccurs="1" maxOccurs="unbounded"/>
                <xsd:element ref="PID.4" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.5" minOccurs="1" maxOccurs="unbounded"/>
                <xsd:element ref="PID.6" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.7" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.8" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.9" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.10" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.11" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.12" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.13" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.14" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.15" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.16" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.17" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.18" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.19" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.20" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.21" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.22" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.23" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.24" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.25" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.26" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.27" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.28" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.29" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.30" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.31" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.32" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID.33" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.34" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.35" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.36" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.37" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.38" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="PID.39" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:any processContents="lax" namespace="##other" minOccurs="0"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="PID" type="PID.CONTENT"/>
      

    Now assume a corresponding segment of an HL7 message looking like this:

    PID|||33821^^^^MR||TESTCASE^TOM||19590215|M|||1234ANYWHERE PL^^SOMEWHERE^FL^99999|||||||||||||||||||||||||||||

    Needs to be created, or parsed.  What do I do with this XSD to work with this segment?

    Thanks again for the help and patience.

    Thursday, December 29, 2016 12:54 PM
  • User475983607 posted

    Needs to be created, or parsed.  What do I do with this XSD to work with this segment?

    HL7 is a protocol (language) Heath Information Systems use to communicate with each other.  XML\XSD is not HL7 and is its own protocol for moving data between service endpoints. You're mixing the two protocols; XML and HL7.

    XML/XSD does not natively convert to HL7 but it does work well with .NET types.  In turn, .NET types can be used to populate HL7 segments for use in an HIS.  

    Also, in the XML world, XSLT, is a style sheet langue used to convert XML in to other formats like HL7, CSV, HTML, etc.

    Thursday, December 29, 2016 2:46 PM
  • User1122355199 posted

    OK.  So I'm back to the original question.  I am very familiar with HL7 messaging, rolling most of my own code.  HL7.org provides these XSD schemas and I see some of the open source parsers use these schemas.  So are the XSD files simply to provide datatypes that a class library can be built from rather than building your own class library, then values have to be programmatically set?

    Thursday, December 29, 2016 3:06 PM
  • User1122355199 posted

    Separately, there is another XSD for a typical type of HL7 message that looks like this:

    <?xml version ="1.0" encoding="UTF-8"?>
    <!--
        v2.xml Message Definitions Version v2.5.1  - VXU_V04
        HL7® Version 2.5.1, © Health Level Seven, Inc.  All rights reserved.  HL7 and Health Level Seven are registered trademarks of Health Level Seven, Inc.
    -->
    <xsd:schema
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="urn:hl7-org:v2xml"
        xmlns:hl7="urn:com.sun:encoder-hl7-1.0"
        targetNamespace="urn:hl7-org:v2xml" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0">
    
        <!-- include segment definitions for version v2.5.1 -->
        <xsd:include schemaLocation="segments.xsd"/>
    
        <xsd:annotation>
    	<xsd:appinfo source="urn:com.sun:encoder">
    	    <encoding xmlns="urn:com.sun:encoder" name="HL7 v2 Encoding" namespace="urn:com.sun:encoder-hl7-1.0" style="hl7encoder-1.0"/>
    	</xsd:appinfo>
        </xsd:annotation>
    
        <!--
    	MESSAGE VXU_V04
        -->
        <!-- .. groups used in message VXU_V04 -->
        <xsd:complexType name="VXU_V04.PATIENT.CONTENT">
            <xsd:sequence>
                <xsd:element ref="PV1" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="PV2" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="VXU_V04.PATIENT" type="VXU_V04.PATIENT.CONTENT"/>
        <xsd:complexType name="VXU_V04.INSURANCE.CONTENT">
            <xsd:sequence>
                <xsd:element ref="IN1" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="IN2" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="IN3" minOccurs="0" maxOccurs="1"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="VXU_V04.INSURANCE" type="VXU_V04.INSURANCE.CONTENT"/>
        <xsd:complexType name="VXU_V04.TIMING.CONTENT">
            <xsd:sequence>
                <xsd:element ref="TQ1" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="TQ2" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="VXU_V04.TIMING" type="VXU_V04.TIMING.CONTENT"/>
        <xsd:complexType name="VXU_V04.OBSERVATION.CONTENT">
            <xsd:sequence>
                <xsd:element ref="OBX" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="NTE" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="VXU_V04.OBSERVATION" type="VXU_V04.OBSERVATION.CONTENT"/>
        <xsd:complexType name="VXU_V04.ORDER.CONTENT">
            <xsd:sequence>
                <xsd:element ref="ORC" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="VXU_V04.TIMING" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="RXA" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="RXR" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="VXU_V04.OBSERVATION" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="VXU_V04.ORDER" type="VXU_V04.ORDER.CONTENT"/>
        <!-- .. message definition VXU_V04 -->
        <xsd:complexType name="VXU_V04.CONTENT">
            <xsd:sequence>
                <xsd:element ref="MSH" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="SFT" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="PID" minOccurs="1" maxOccurs="1"/>
                <xsd:element ref="PD1" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="NK1" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="VXU_V04.PATIENT" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="GT1" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="VXU_V04.INSURANCE" minOccurs="0" maxOccurs="unbounded"/>
                <xsd:element ref="VXU_V04.ORDER" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="VXU_V04" type="VXU_V04.CONTENT">
            <xsd:annotation>
                <xsd:appinfo source="urn:com.sun:encoder">
                    <top xmlns="urn:com.sun:encoder">true</top>
                </xsd:appinfo>
            </xsd:annotation>
        </xsd:element>
    </xsd:schema>
    

    This lays out the sequence of segments when building the HL7 message.  So obviously there is a way to consume these XSD to build messages, but I don't understand how.  Its a little more complex than the Microsoft tutorials.  I really appreciate the help.

    Thursday, December 29, 2016 3:22 PM
  • User475983607 posted

    This lays out the sequence of segments when building the HL7 message.  So obviously there is a way to consume these XSD to build messages, but I don't understand how.  Its a little more complex than the Microsoft tutorials.  I really appreciate the help.

    XSD is simply the schema definition and XML is the data.  XSD is to XML as a database table is to data.

    Use the XSD files to create classes to hold the data.

    https://msdn.microsoft.com/en-us/library/5s2x1sy7(v=vs.110).aspx

    https://msdn.microsoft.com/en-us/library/x6c1kb0s(v=vs.110).aspx

    You're making this far more complicated than it is.  

    Thursday, December 29, 2016 4:41 PM
  • User1122355199 posted

    Again, thanks for the help.  Perhaps I am making it more complicated, but maybe not.  So conceptually, the only purpose of the XSD files is to create classes rather than having to roll your own.  Makes sense I suppose, however, I think there is more to the entire HL7 FHIR initiative, but I'll worry about that when I get anything working.  So I tried converting one of the 206 XSD files to a class using the command line tool (see I can be taught and do read thing :)).  So this generated several hundred error messages looking like this:

    Schema validation warning: Could not find file "fields.xsd".
    Schema validation warning: The 'urn:hl7-org:v2xml:VTQ.1' element is not declared. Line 3484, position 14.
    Schema validation warning: The 'urn:hl7-org:v2xml:VTQ.2' element is not declared. Line 3485, position 14.
    Schema validation warning: The 'urn:hl7-org:v2xml:VTQ.3' element is not declared. Line 3486, position 14.
    
    

    etc. etc. etc. finishing with:

    Warning: Schema could not be validated. Class generation may fail or may produce incorrect results.
    
    Error: Error generating classes for schema 'C:\segments'.
      - The element 'urn:hl7-org:v2xml:ABS.1' is missing.

    No file was generated.  The first part of the through the ABS.1 looks like:

    <?xml version ="1.0" encoding="UTF-8"?>
    <!--
        v2.xml Message Definitions Version v2.5.1  - segments
        HL7® Version 2.5.1, © Health Level Seven, Inc.  All rights reserved.  HL7 and Health Level Seven are registered trademarks of Health Level Seven, Inc.
    -->
    <xsd:schema
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="urn:hl7-org:v2xml"
        xmlns:hl7="urn:com.sun:encoder-hl7-1.0"
        targetNamespace="urn:hl7-org:v2xml" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0">
    
        <!-- include fields definitions for version v2.5.1 -->
        <xsd:include schemaLocation="fields.xsd"/>
    
        <xsd:annotation>
            <xsd:appinfo source="urn:com.sun:encoder">
                <encoding xmlns="urn:com.sun:encoder" name="HL7 v2 Encoding" namespace="urn:com.sun:encoder-hl7-1.0" style="hl7encoder-1.0"/>
            </xsd:appinfo>
        </xsd:annotation>
    
        <!--
            SEGMENT ABS
        -->
        <xsd:complexType name="ABS.CONTENT">
            <xsd:sequence>
                <xsd:element ref="ABS.1" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.2" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.3" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.4" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.5" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.6" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.7" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.8" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.9" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.10" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.11" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.12" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.13" minOccurs="0" maxOccurs="1"/>
                <xsd:element ref="ABS.14" minOccurs="0" maxOccurs="1"/>
                <xsd:any processContents="lax" namespace="##other" minOccurs="0"/>
            </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="ABS" type="ABS.CONTENT"/>
        

    Not sure what is wrong.

    Friday, December 30, 2016 2:57 AM
  • User475983607 posted

    kmcnet

    Perhaps I am making it more complicated, but maybe not.  So conceptually, the only purpose of the XSD files is to create classes rather than having to roll your own. 

    No, an XSD is an XSD is an XSD.  At this point, it pointless to continue posting the XSD definition as you keep adding your own spin to the technology.

    kmcnet

    Not sure what is wrong.

    The error message clearly states the fields.xsd file was not found.  I would start my troubleshooting by finding the fields.xsd file and/or reading the XSD owners support documentation.

    Friday, December 30, 2016 11:12 AM
  • User1122355199 posted

    Again, thanks for the response.  I'm really not sure where you are getting the "adding my own spin" to the technology.  The error message I'm encountering actually occurs when trying to build a class from the fileds .xsd file as well, so the error is not obvious, nor have you answered anything more than the continual "an xsd is an xsd" which is again obvious just like a "horse is a horse" yet completely unhelpful.  Additionally, anyone can point to and find links on the Microsoft site with ubiquitous examples that do not tackle real complex tasks that developers encounter in real life.  You incorrectly assume I have read none of the documentation, when I have.  Additionally, there appear to be some issues with BizTalk server working with these schema and needing an update tool (https://msdn.microsoft.com/en-us/library/ee404912.aspx).  so the .Net class transformation likely will no twork with these schemas.

    While I appreciate you are frustrated with my posts, I am also frustrated with the basic "read the Northwind database example" when creating and parsing HL7 messages is a complex enterprise topic.  Clearly, many of the open source parsers utilize XML and XSD to do more than build class libraries and goes beyond what is found on W3Schools.  In the timeframe of this post, I built a production ready interface with a state immunization database (without XML and XSD) so I might know a little about HL7:

    "HL7 is a protocol (language) Heath Information Systems use to communicate with each other.  XML\XSD is not HL7 and is its own protocol for moving data between service endpoints. You're mixing the two protocols; XML and HL7."

    So no Captain Obvious, I do understand the difference between XML\XSD and HL7 given I have built a working electronic health record system that communicates using HL7 with numerous state health exchanges as well as national vendors such as labs. 

    So the original question, which will remain unanswered, is how to efficiently utilize XML and XSD to parse and create HL7 messages in lieu of creating class libraries and string concatenator routines from scratch. 

    Again, I appreciate the attempts to help, however, my questions are valid and need not be dismissed so readily.

    Thank you again.

    Friday, December 30, 2016 6:24 PM
  • User475983607 posted

    kmcnet

    So no Captain Obvious, I do understand the difference between XML\XSD and HL7 given I have built a working electronic health record system that communicates using HL7 with numerous state health exchanges as well as national vendors such as labs. 

    So the original question, which will remain unanswered, is how to efficiently utilize XML and XSD to parse and create HL7 messages in lieu of creating class libraries and string concatenator routines from scratch.

    Ya don't...  

    XML/XSD can be used to represent HL7.  There is no direct conversion between the formats without introducing logic.

    In HL7 the segment rules are documented.  In XML the rules are in the XSD.

    In the XML world, XSLT is one way to convert XML into the HL7 format without the need for .NET classes.  

    Friday, December 30, 2016 11:07 PM
  • User1122355199 posted

    Again, I appreciate the response, but we're not communicating and the question is not answered in my mind.  I know there is no direct conversion.  However, there is a reason XML and XSD is being used instead of class libraries.  Why?

    Next question.  The XSD files that I have been scolded for posting do not parse using the .Net XSD converter, even though the XSD files were downloaded from the HL7.org site.  So there is something wrong with the parser or the XSD files are wrong.  Neither explanation seems to make sense.  So either I'm not understanding how to convert these files, or the XSD/XML approach is a cul-de-sac not worth pursuing.

    So if I understand, you don't work directly with XSD files, but need to convert them into either a class library, or apply them to an XML file.  Am I understanding and if not, PLEASE explain.

    Saturday, December 31, 2016 5:45 PM
  • User475983607 posted

    kmcnet

    Again, I appreciate the response, but we're not communicating and the question is not answered in my mind.  I know there is no direct conversion.  However, there is a reason XML and XSD is being used instead of class libraries.  Why?

    XML/XSD is platform agnostic. The use of XML is just the way technology went.  You'll also see HL7 in JSON format.

    kmcnet

    Next question.  The XSD files that I have been scolded for posting do not parse using the .Net XSD converter, even though the XSD files were downloaded from the HL7.org site.  So there is something wrong with the parser or the XSD files are wrong.  Neither explanation seems to make sense.  So either I'm not understanding how to convert these files, or the XSD/XML approach is a cul-de-sac not worth pursuing.

    I'm not sure what the problem is but briefly reading the readme.txt file on the HL7.org site indicates there are a known issues with the schema files.  The XSDs are open source files. It is up to you to determine if the files are of any value.  Have you considered contacting the HL7.org support? Likewise there are .NET compatible XSD parsers on the Internet if you feel xsd.exe is not working properly.

    kmcnet

    So if I understand, you don't work directly with XSD files, but need to convert them into either a class library, or apply them to an XML file.  Am I understanding and if not, PLEASE explain.

    An XSD file is like an empty SQL table; the Data Definition Logic (DDL).  If you have data and wish to store the data in a database, you need to build a table.  The table schema has constraints like the column named ID is an integer.  The same concept applies to an XSD.  

    Let's assume you writing an XML service and you want everyone using your service to adhere to a certain data interface.  You give all the clients an XSD (the schema) and tell the clients to use the XSD to format the data properly.  When a client sends XML to the service. the service validates the XML against the XSD.  If the XML passes validation then the data is processed.  Otherwise, the validation fails, the service rejects the XML, and service tells the client what validation rule fired. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 31, 2016 7:46 PM
  • User1122355199 posted

    Thanks again for the response.  Yes, I had read the readme file and contacted HL7.org, but have yet to receive a response.  Your last response clarified what I need to know.  I really haven't tried another parser since I'm really a newbie on XSD.  For now, it sounds like I should just keep manually coding my class libraries since there seem to be known issues. with the XSD downloads.  Not the most elegant, but it works.

    Thanks again.

    Tuesday, January 3, 2017 5:01 PM