<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Not able to load nested XML file with struct type in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/not-able-to-load-nested-xml-file-with-struct-type/m-p/58187#M31042</link>
    <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;I am trying to load XML with struct type and having XSI type attribute. below is sample XML format:&lt;/P&gt;&lt;P&gt;&amp;lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="&lt;A href="http://schemas.xmlsoap.org/soap/envelope/" target="_blank"&gt;http://schemas.xmlsoap.org/soap/envelope/&lt;/A&gt;" xmlns:xsd="&lt;A href="http://www.w3.org/2001/XMLSchema" target="_blank"&gt;http://www.w3.org/2001/XMLSchema&lt;/A&gt;" xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;" xmlns:SOAP-ENC="&lt;A href="http://schemas.xmlsoap.org/soap/encoding/" target="_blank"&gt;http://schemas.xmlsoap.org/soap/encoding/&lt;/A&gt;" xmlns:tns="&lt;A href="https://api.example.com" target="_blank"&gt;https://api.example.com&lt;/A&gt;" SOAP-ENV:encodingStyle="&lt;A href="http://schemas.xmlsoap.org/soap/encoding/" target="_blank"&gt;http://schemas.xmlsoap.org/soap/encoding/&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;lt;SOAP-ENV:Body&amp;gt;&lt;BR /&gt;&amp;lt;ns1:wsdlGetEmployeesV2Response xmlns:ns1="&lt;A href="http://schemas.xmlsoap.org/soap/envelope/" target="_blank"&gt;http://schemas.xmlsoap.org/soap/envelope/&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;lt;return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:Employee[3]"&amp;gt;&lt;BR /&gt;&amp;lt;item xsi:type="tns:Employee"&amp;gt;&lt;BR /&gt;&amp;lt;id xsi:type="xsd:int"&amp;gt;1111&amp;lt;/id&amp;gt;&lt;BR /&gt;&amp;lt;SerialNo xsi:type="xsd:string"&amp;gt;0001A&amp;lt;/badgeNo&amp;gt;&lt;BR /&gt;&amp;lt;additionalFields xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:AdditionalFieldData[4]"&amp;gt;&lt;BR /&gt;&amp;lt;item xsi:type="tns:AdditionalFieldData"&amp;gt;&lt;BR /&gt;&amp;lt;key xsi:type="xsd:string"&amp;gt;employeecc&amp;lt;/key&amp;gt;&lt;BR /&gt;&amp;lt;value xsi:type="xsd:string"/&amp;gt;&lt;BR /&gt;&amp;lt;/item&amp;gt;&lt;BR /&gt;&amp;lt;/additionalFields&amp;gt;&lt;BR /&gt;&amp;lt;grpRoles xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:GrpRoles[2]"&amp;gt;&lt;BR /&gt;&amp;lt;item xsi:type="tns:GrpRoles"&amp;gt;&lt;BR /&gt;&amp;lt;groupId xsi:type="xsd:int"&amp;gt;9999&amp;lt;/groupId&amp;gt;&lt;BR /&gt;&amp;lt;groupName xsi:type="xsd:string"&amp;gt;Test group&amp;lt;/groupName&amp;gt;&lt;BR /&gt;&amp;lt;extGroupId xsi:type="xsd:string"/&amp;gt;&lt;BR /&gt;&amp;lt;/item&amp;gt;&lt;BR /&gt;&amp;lt;/grpRoles&amp;gt;&lt;BR /&gt;&amp;lt;ts xsi:type="xsd:dateTime"&amp;gt;2011-110-02T12:18:42+01:00&amp;lt;/ts&amp;gt;&lt;BR /&gt;&amp;lt;/item&amp;gt;&lt;BR /&gt;&amp;lt;/return&amp;gt;&lt;BR /&gt;&amp;lt;/ns1:wsdlGetEmployeesV2Response&amp;gt;&lt;BR /&gt;&amp;lt;/SOAP-ENV:Body&amp;gt;&lt;BR /&gt;&amp;lt;/SOAP-ENV:Envelope&amp;gt;&lt;/P&gt;&lt;P&gt;I tried using&amp;nbsp;&lt;SPAN&gt;xml.etree.ElementTree and&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;pandas dataframe, but we have to define schema while loading dataframe to table. Is there any way to load above XML using infer schema?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vishal&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2024 17:13:41 GMT</pubDate>
    <dc:creator>VishalD</dc:creator>
    <dc:date>2024-01-22T17:13:41Z</dc:date>
    <item>
      <title>Not able to load nested XML file with struct type</title>
      <link>https://community.databricks.com/t5/data-engineering/not-able-to-load-nested-xml-file-with-struct-type/m-p/58187#M31042</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;I am trying to load XML with struct type and having XSI type attribute. below is sample XML format:&lt;/P&gt;&lt;P&gt;&amp;lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="&lt;A href="http://schemas.xmlsoap.org/soap/envelope/" target="_blank"&gt;http://schemas.xmlsoap.org/soap/envelope/&lt;/A&gt;" xmlns:xsd="&lt;A href="http://www.w3.org/2001/XMLSchema" target="_blank"&gt;http://www.w3.org/2001/XMLSchema&lt;/A&gt;" xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" target="_blank"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;" xmlns:SOAP-ENC="&lt;A href="http://schemas.xmlsoap.org/soap/encoding/" target="_blank"&gt;http://schemas.xmlsoap.org/soap/encoding/&lt;/A&gt;" xmlns:tns="&lt;A href="https://api.example.com" target="_blank"&gt;https://api.example.com&lt;/A&gt;" SOAP-ENV:encodingStyle="&lt;A href="http://schemas.xmlsoap.org/soap/encoding/" target="_blank"&gt;http://schemas.xmlsoap.org/soap/encoding/&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;lt;SOAP-ENV:Body&amp;gt;&lt;BR /&gt;&amp;lt;ns1:wsdlGetEmployeesV2Response xmlns:ns1="&lt;A href="http://schemas.xmlsoap.org/soap/envelope/" target="_blank"&gt;http://schemas.xmlsoap.org/soap/envelope/&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;lt;return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:Employee[3]"&amp;gt;&lt;BR /&gt;&amp;lt;item xsi:type="tns:Employee"&amp;gt;&lt;BR /&gt;&amp;lt;id xsi:type="xsd:int"&amp;gt;1111&amp;lt;/id&amp;gt;&lt;BR /&gt;&amp;lt;SerialNo xsi:type="xsd:string"&amp;gt;0001A&amp;lt;/badgeNo&amp;gt;&lt;BR /&gt;&amp;lt;additionalFields xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:AdditionalFieldData[4]"&amp;gt;&lt;BR /&gt;&amp;lt;item xsi:type="tns:AdditionalFieldData"&amp;gt;&lt;BR /&gt;&amp;lt;key xsi:type="xsd:string"&amp;gt;employeecc&amp;lt;/key&amp;gt;&lt;BR /&gt;&amp;lt;value xsi:type="xsd:string"/&amp;gt;&lt;BR /&gt;&amp;lt;/item&amp;gt;&lt;BR /&gt;&amp;lt;/additionalFields&amp;gt;&lt;BR /&gt;&amp;lt;grpRoles xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:GrpRoles[2]"&amp;gt;&lt;BR /&gt;&amp;lt;item xsi:type="tns:GrpRoles"&amp;gt;&lt;BR /&gt;&amp;lt;groupId xsi:type="xsd:int"&amp;gt;9999&amp;lt;/groupId&amp;gt;&lt;BR /&gt;&amp;lt;groupName xsi:type="xsd:string"&amp;gt;Test group&amp;lt;/groupName&amp;gt;&lt;BR /&gt;&amp;lt;extGroupId xsi:type="xsd:string"/&amp;gt;&lt;BR /&gt;&amp;lt;/item&amp;gt;&lt;BR /&gt;&amp;lt;/grpRoles&amp;gt;&lt;BR /&gt;&amp;lt;ts xsi:type="xsd:dateTime"&amp;gt;2011-110-02T12:18:42+01:00&amp;lt;/ts&amp;gt;&lt;BR /&gt;&amp;lt;/item&amp;gt;&lt;BR /&gt;&amp;lt;/return&amp;gt;&lt;BR /&gt;&amp;lt;/ns1:wsdlGetEmployeesV2Response&amp;gt;&lt;BR /&gt;&amp;lt;/SOAP-ENV:Body&amp;gt;&lt;BR /&gt;&amp;lt;/SOAP-ENV:Envelope&amp;gt;&lt;/P&gt;&lt;P&gt;I tried using&amp;nbsp;&lt;SPAN&gt;xml.etree.ElementTree and&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;pandas dataframe, but we have to define schema while loading dataframe to table. Is there any way to load above XML using infer schema?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vishal&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 17:13:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/not-able-to-load-nested-xml-file-with-struct-type/m-p/58187#M31042</guid>
      <dc:creator>VishalD</dc:creator>
      <dc:date>2024-01-22T17:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to load nested XML file with struct type</title>
      <link>https://community.databricks.com/t5/data-engineering/not-able-to-load-nested-xml-file-with-struct-type/m-p/58206#M31048</link>
      <description>&lt;P&gt;You can try to use from_xml() function, here is the link to the docs&amp;nbsp;&lt;A href="https://docs.databricks.com/en/sql/language-manual/functions/from_xml.html" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/functions/from_xml.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 23:18:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/not-able-to-load-nested-xml-file-with-struct-type/m-p/58206#M31048</guid>
      <dc:creator>jose_gonzalez</dc:creator>
      <dc:date>2024-01-22T23:18:24Z</dc:date>
    </item>
  </channel>
</rss>

