Announcement

Collapse
No announcement yet.

.NET XML interpretation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • .NET XML interpretation

    I am having trouble parsing out an XML file returned from a .NET webservice.

    The web service returns a table of residents when invoked. The first part is the schema, and the rest is values. How do I tell Mirth to use the schema to extract the rest of the values into an SQL Database. I don't have to extract the schema, I can just paste it into the message template and use it to map the values.. I think.

    Here is a sample returning two residents with their auxillary data.

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <ResidentsDataTable xmlns="http://www.arlynweb.com:82/webservices/">
      <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
        <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Residents" msdata:UseCurrentLocale="true">
          <xs:complexType>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element name="Residents">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="ResidentId">
    
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="32" />
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="LastName" minOccurs="0">
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
    
                          <xs:maxLength value="32" />
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="FirstName" minOccurs="0">
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="32" />
                        </xs:restriction>
    
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="MidName" minOccurs="0">
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="32" />
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
    
                    <xs:element name="Birthdate" type="xs:dateTime" minOccurs="0" />
                    <xs:element name="Image" type="xs:base64Binary" minOccurs="0" />
                    <xs:element name="Location" minOccurs="0">
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="32" />
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
    
                    <xs:element name="PulseRateHi" type="xs:int" />
                    <xs:element name="PulseRateLo" type="xs:int" />
                    <xs:element name="PulseRateGlobal" type="xs:boolean" />
                    <xs:element name="BpSystHi" type="xs:int" />
                    <xs:element name="BpSystLo" type="xs:int" />
                    <xs:element name="BpSystGlobal" type="xs:boolean" />
                    <xs:element name="BpDiastHi" type="xs:int" />
                    <xs:element name="BpDiastLo" type="xs:int" />
                    <xs:element name="BpDiastGlobal" type="xs:boolean" />
    
                    <xs:element name="SpO2Hi" type="xs:int" minOccurs="0" />
                    <xs:element name="SpO2Lo" type="xs:int" />
                    <xs:element name="SpO2Global" type="xs:boolean" />
                    <xs:element name="TempHi" type="xs:double" />
                    <xs:element name="TempLo" type="xs:double" />
                    <xs:element name="TempGlobal" type="xs:boolean" />
                    <xs:element name="WeightHi" type="xs:double" minOccurs="0" />
                    <xs:element name="WeightLo" type="xs:double" minOccurs="0" />
                    <xs:element name="WeightGlobal" type="xs:boolean" />
    
                    <xs:element name="BglHi" type="xs:int" />
                    <xs:element name="BglLo" type="xs:int" />
                    <xs:element name="BglGlobal" type="xs:boolean" />
                    <xs:element name="Unused" type="xs:boolean" />
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:choice>
          </xs:complexType>
    
          <xs:unique name="Constraint1" msdata:PrimaryKey="true">
            <xs:selector xpath=".//Residents" />
            <xs:field xpath="ResidentId" />
          </xs:unique>
        </xs:element>
      </xs:schema>
      <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
        <DocumentElement xmlns="">
          <Residents diffgr:id="Residents1" msdata:rowOrder="0">
    
            <ResidentId>
    de la Hoya0006</ResidentId>
            <LastName>de la Hoya</LastName>
            <FirstName>Oscar</FirstName>
            <MidName>P</MidName>
            <Birthdate>1940-08-19T00:00:00-04:00</Birthdate>
            <Location>150B</Location>
    
            <PulseRateHi>100</PulseRateHi>
            <PulseRateLo>50</PulseRateLo>
            <PulseRateGlobal>false</PulseRateGlobal>
            <BpSystHi>160</BpSystHi>
            <BpSystLo>90</BpSystLo>
            <BpSystGlobal>false</BpSystGlobal>
    
            <BpDiastHi>100</BpDiastHi>
            <BpDiastLo>60</BpDiastLo>
            <BpDiastGlobal>false</BpDiastGlobal>
            <SpO2Hi>101</SpO2Hi>
            <SpO2Lo>94</SpO2Lo>
            <SpO2Global>false</SpO2Global>
    
            <TempHi>104</TempHi>
            <TempLo>95</TempLo>
            <TempGlobal>false</TempGlobal>
            <WeightHi>250</WeightHi>
            <WeightLo>220</WeightLo>
            <WeightGlobal>false</WeightGlobal>
    
            <BglHi>180</BglHi>
            <BglLo>55</BglLo>
            <BglGlobal>false</BglGlobal>
            <Unused>false</Unused>
          </Residents>
          <Residents diffgr:id="Residents2" msdata:rowOrder="1">
            <ResidentId>
    
    Smith00121</ResidentId>
            <LastName>Smith</LastName>
            <FirstName>Graham</FirstName>
            <MidName>C</MidName>
            <Birthdate>1940-11-03T00:00:00-04:00</Birthdate>
            <Location>156B</Location>
    
            <PulseRateHi>120</PulseRateHi>
            <PulseRateLo>80</PulseRateLo>
            <PulseRateGlobal>false</PulseRateGlobal>
            <BpSystHi>160</BpSystHi>
            <BpSystLo>90</BpSystLo>
            <BpSystGlobal>false</BpSystGlobal>
    
            <BpDiastHi>100</BpDiastHi>
            <BpDiastLo>60</BpDiastLo>
            <BpDiastGlobal>false</BpDiastGlobal>
            <SpO2Hi>101</SpO2Hi>
            <SpO2Lo>94</SpO2Lo>
            <SpO2Global>false</SpO2Global>
    
            <TempHi>104</TempHi>
            <TempLo>95</TempLo>
            <TempGlobal>false</TempGlobal>
            <WeightHi>290</WeightHi>
            <WeightLo>260</WeightLo>
            <WeightGlobal>false</WeightGlobal>
    
            <BglHi>180</BglHi>
            <BglLo>55</BglLo>
            <BglGlobal>false</BglGlobal>
            <Unused>false</Unused>
          </Residents>
        </DocumentElement>
      </diffgr:diffgram>
    </ResidentsDataTable>
    Btw, very new to Mirth.

    Thanks,
    Last edited by mmkarim; 09-15-2010, 10:33 AM. Reason: Added tags
Working...
X