parse_xml function help

Occasional Contributor

Hello,

 

I'd like to use the parse_xml() function to read an assortment of values inside my pcinfo.xml file. I added the pcinfo.xml file as a custom log to ALA using newline. Since I can't upload an XML file I've pasted the contents of a sample file to the bottom of this post. 

 

When I extend and use parse_xml on my RawData the result is not what I expect for a few reasons.

1) It's not picking up all my tags inside the XML file which is not allowing me to call the variables because of the duplication of tags. See the pcinfo column below in my screenshot. 

For example:

SiteName, I'd expect the value to be accessed as  PCInformation.SiteName and return 0566019. As you can see in the screenshot below it is accessed as just SiteName and not PCInformation.SiteName

or PCInformation.HardwareReport.PinPad.FirmwareVersion should return 30.01

 

2) It's converting any numbers that start with 0 (I've highlighted in the screenshot)

 

https://docs.microsoft.com/en-us/azure/kusto/query/parse-xmlfunction 

 

parse_xml.PNG

 

<?xml version="1.0" ?>
<PCInformation>
<SiteName>0566019</SiteName>
<DeviceName>BT9000</DeviceName>
<BT9000_Version>060108</BT9000_Version>
<TerminalNum>056601901</TerminalNum>
<HardwareReport>
<General>
<HardwareRecord>
<HardwareInfo>
<HardwareType>Pumps</HardwareType>
<BoardType>NORMAL PC SERIAL PORT</BoardType>
<PortNumber>4</PortNumber>
<Manufacturer>GILBARCO</Manufacturer>
</HardwareInfo>
<HardwareDetails>
<SerialNumber></SerialNumber>
<ModelNumber></ModelNumber>
<RevisionNumber></RevisionNumber>
<FirmwareVersion></FirmwareVersion>
</HardwareDetails>
</HardwareRecord>
<HardwareRecord>
<HardwareInfo>
<HardwareType>Scanner</HardwareType>
<BoardType>NORMAL PC SERIAL PORT</BoardType>
<PortNumber>11</PortNumber>
<Manufacturer>DS9208</Manufacturer>
</HardwareInfo>
<HardwareDetails>
<SerialNumber></SerialNumber>
<ModelNumber></ModelNumber>
<RevisionNumber></RevisionNumber>
<FirmwareVersion></FirmwareVersion>
</HardwareDetails>
</HardwareRecord>
<HardwareRecord>
<HardwareInfo>
<HardwareType>Price Sign</HardwareType>
<BoardType>NORMAL PC SERIAL PORT</BoardType>
<PortNumber>9</PortNumber>
<Manufacturer>NOVYC</Manufacturer>
</HardwareInfo>
<HardwareDetails>
<SerialNumber></SerialNumber>
<ModelNumber></ModelNumber>
<RevisionNumber></RevisionNumber>
<FirmwareVersion></FirmwareVersion>
</HardwareDetails>
</HardwareRecord>
<HardwareRecord>
<HardwareInfo>
<HardwareType>Debit device/Pinpad</HardwareType>
<BoardType>NORMAL PC SERIAL PORT</BoardType>
<PortNumber>8</PortNumber>
<Manufacturer>INGENICO</Manufacturer>
</HardwareInfo>
<HardwareDetails>
<SerialNumber>00000000/62000029/ING10000</SerialNumber>
<ModelNumber>LANE3000</ModelNumber>
<RevisionNumber> </RevisionNumber>
<FirmwareVersion>30.01</FirmwareVersion>
</HardwareDetails>
</HardwareRecord>
<HardwareRecord>
<HardwareInfo>
<HardwareType>CRINDs</HardwareType>
<BoardType>NORMAL PC SERIAL PORT</BoardType>
<PortNumber>6</PortNumber>
<Manufacturer>GILBARCO EMV</Manufacturer>
</HardwareInfo>
<HardwareDetails>
<SerialNumber></SerialNumber>
<ModelNumber></ModelNumber>
<RevisionNumber></RevisionNumber>
<FirmwareVersion></FirmwareVersion>
</HardwareDetails>
</HardwareRecord>
</General>
<Printer>
<HardwareType>Receipt Printer</HardwareType>
<BoardType>NORMAL PC SERIAL PORT</BoardType>
<PortNumber>7</PortNumber>
<Manufacturer>TMT20</Manufacturer>
</Printer>
<PinPad>
<HardwareType>Pinpad </HardwareType>
<BoardType>NORMAL PC SERIAL PORT</BoardType>
<PortNumber>8</PortNumber>
<Manufacturer>INGENICO</Manufacturer>
<SerialNumber>00000000/62000029/ING10000</SerialNumber>
<ModelNumber>LANE3000</ModelNumber>
<RevisionNumber> </RevisionNumber>
<FirmwareVersion>30.01</FirmwareVersion>
</PinPad>
<Pumps>
<PumpRecord>
<PumpNumber>1</PumpNumber>
<PumpSerialNumber>2830-030304040001</PumpSerialNumber>
<PumpModelNumber>40</PumpModelNumber>
<PumpRevisionNumber>000000</PumpRevisionNumber>
</PumpRecord>
<PumpRecord>
<PumpNumber>2</PumpNumber>
<PumpSerialNumber>2830-030304040001</PumpSerialNumber>
<PumpModelNumber>40</PumpModelNumber>
<PumpRevisionNumber>000000</PumpRevisionNumber>
</PumpRecord>
<PumpRecord>
<PumpNumber>3</PumpNumber>
<PumpSerialNumber>3040030304040001</PumpSerialNumber>
<PumpModelNumber>40</PumpModelNumber>
<PumpRevisionNumber>072814</PumpRevisionNumber>
</PumpRecord>
</Pumps>
<AFDs>
<AFDRecord>
<AFDNumber>1</AFDNumber>
<AFDSerialNumber>0002061101704345</AFDSerialNumber>
<AFDModelNumber>SPOT M3</AFDModelNumber>
<AFDRevisionNumber>01.07</AFDRevisionNumber>
</AFDRecord>
<AFDRecord>
<AFDNumber>2</AFDNumber>
<AFDSerialNumber>0002061101704837</AFDSerialNumber>
<AFDModelNumber>SPOT M3</AFDModelNumber>
<AFDRevisionNumber>1.07</AFDRevisionNumber>
</AFDRecord>
<AFDRecord>
<AFDNumber>3</AFDNumber>
<AFDSerialNumber></AFDSerialNumber>
<AFDModelNumber></AFDModelNumber>
<AFDRevisionNumber></AFDRevisionNumber>
</AFDRecord>
</AFDs>
</HardwareReport>
<SystemReport>
<General>
<PCModel>HP RP9 G1 AiO Retail System, </PCModel>
<SerialNumber>2UA8212H0N</SerialNumber>
</General>
<Processors>
<NumberOfProcessors>4</NumberOfProcessors>
<ProcessorType>Intel Pentium II</ProcessorType>
<ProcessorRevision>40457</ProcessorRevision>
</Processors>
<OperatingSystem>
<Platform>Windows 8</Platform>
<BuildNumber>9200</BuildNumber>
<ServicePack>0.0</ServicePack>
</OperatingSystem>
<Memory>
<PageSize>4096 Bytes</PageSize>
<TotalPhysical>16263 MB</TotalPhysical>
<AvailablePhysical>14154 MB</AvailablePhysical>
<TotalVirtual>2047 MB</TotalVirtual>
<AvailableVirtual>1513 MB</AvailableVirtual>
</Memory>
<Disk>
<TotalDiskSpace>115486 MB</TotalDiskSpace>
<FreeDiskSpace>13158 MB</FreeDiskSpace>
<UserDiskSpace>13158 MB</UserDiskSpace>
</Disk>
<Network>
<IPAddress>10.172.250.25</IPAddress>
<DefaultGatewayIP>10.172.250.1</DefaultGatewayIP>
<SubnetMask>255.255.255.192</SubnetMask>
<DNSServersPrimary>10.31.32.36</DNSServersPrimary>
<DNSServersAlternate>10.31.32.37</DNSServersAlternate>
</Network>
<NetworkAdapter>
<ActiveLANName>Intel(R) Ethernet Connection </ActiveLANName>
</NetworkAdapter>
</SystemReport>
<TimeZone>
<TimeZone>(UTC-05:00) Eastern Time (US &amp; Canada)</TimeZone>
<Day>2</Day>
<Month>3</Month>
<Bias>-60</Bias>
<DSTDisable>TRUE</DSTDisable>
</TimeZone>
<LastBoot>2019-05-07 09:38:13</LastBoot>
</PCInformation>

 

0 Replies