Extract Data from XML Files using DOM

2 views (last 30 days)
Avri
Avri on 10 Feb 2014
I'm new with DOM and need help. I need to extract a matrix or cell array of Cows and Rs note that in the files there are few MilkData
if true
<?xml version="1.0"?>
<MeasurementData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" MeasurementMode="Milking" Version="2.2" xmlns="http://www.Killer.co.il">
<UserData>
<Properties>
<Property Name="Time">02-02-14_22-46-20</Property>
<Property Name="FarmName">PBLG_56L_SON_CMP_FWM</Property>
<Property Name="ParlorID">EP396861.04</Property>
<Property Name="StageName">F2_G03_SX</Property>
<Property Name="StallIndex">0</Property>
</Properties>
</UserData>
<MilkData>
<X>193.74158749478056</X>
<Y>143289.85952671184</Y>
<Z>883.88671875</Z>
<NominalInfo>
<MilkFat AngleRelation="ToPresent" MeasurementUnits="Radians">0.95993108859688125</MilkFat>
<MilkProtain AngleRelation="ToPresent" MeasurementUnits="Radians">0</MilkProtain>
</NominalInfo>
<ActualInfo>
<MilkFat AngleRelation="ToPresent" MeasurementUnits="Radians">0.95939178185801488</MilkFat>
<MilkProtain AngleRelation="Farmer" MeasurementUnits="Radians">-6.7747201518106906E-06</MilkProtain>
</ActualInfo>
<I COW="235 " R="0.061118" />
<I COW="236 " R="0.073799" />
<I COW="237 " R="0.08736" />
<I COW="237 " R="0.102212" />
<I COW="238 " R="0.118177" />
<I COW="239." R="0.133479" />
<I COW="240 " R="0.151027" />
<I COW="241 " R="0.167611" />
<I COW="242 " R="0.183692" />
<MilkData>
<X>2102.74158749478056</X>
<Y>1231231.85952671184</Y>
<Z>1023.88671875</Z>
<NominalInfo>
<MilkFat AngleRelation="ToPresent" MeasurementUnits="Radians">0.12313</MilkFat>
<MilkProtain AngleRelation="ToPresent" MeasurementUnits="Radians">1</MilkProtain>
</NominalInfo>
<ActualInfo>
<MilkFat AngleRelation="ToPresent" MeasurementUnits="Radians">0.045</MilkFat>
<MilkProtain AngleRelation="Farmer" MeasurementUnits="Radians">-45.4</MilkProtain>
</ActualInfo>
<I COW="534.389" R="0.212444" />
<I COW="897.205" R="0.321312" />
<I COW="343.021" R="0.534534" />
<I COW="234.837" R="0.567564" />
<I COW="098.653" R="0.567564" />
<I COW="756.469" R="0.345444" />
<I COW="454.285" R="0.345344" />
<I COW="234.101" R="0.867844" />
<I COW="241.917" R="0.345344" />
end

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!