Here are two versions which may help.
Version 1. It build a list of lists of sub-records
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
set theXMLFile to POSIX path of ((path to desktop as text) & "mediainfo.xml")
set theURL to current application's |NSURL|'s fileURLWithPath:theXMLFile
set {theXMLDoc, theError} to current application's NSXMLDocument's alloc()'s initWithContentsOfURL:theURL options:0 |error|:(reference)
if theXMLDoc = missing value then error (theError's localizedDescription() as text)
set {planEvents, theError} to theXMLDoc's nodesForXPath:"//Mediainfo/File/track" |error|:(reference)
if planEvents = missing value then error (theError's localizedDescription() as text)
set planDates to {}
repeat with aNode in planEvents
set aRecord to {}
try
set aValue to (aNode's elementsForName:"Complete_name")'s firstObject()'s stringValue() as text
set end of aRecord to {Complete_name:aValue}
end try
try
set aValue to (aNode's elementsForName:"Format")'s firstObject()'s stringValue() as text
set end of aRecord to {Format:aValue}
end try
try
set aValue to (aNode's elementsForName:"Commercial_name")'s firstObject()'s stringValue() as text
set end of aRecord to {Commercial_name:aValue}
end try
try
set aValue to (aNode's elementsForName:"Format_profile")'s firstObject()'s stringValue() as text
set end of aRecord to {Format_profile:aValue}
end try
try
set aValue to (aNode's elementsForName:"Format_settings")'s firstObject()'s stringValue() as text
set end of aRecord to {Format_settings:aValue}
end try
try
set aValue to (aNode's elementsForName:"File_size")'s firstObject()'s stringValue() as text
set end of aRecord to {File_size:aValue}
end try
try
set aValue to (aNode's elementsForName:"Duration")'s firstObject()'s stringValue() as text
set end of aRecord to {Duration:aValue}
end try
try
set aValue to (aNode's elementsForName:"Overall_bit_rate")'s firstObject()'s stringValue() as text
set end of aRecord to {Overall_bit_rate:aValue}
end try
try
set aValue to (aNode's elementsForName:"Encoded_date")'s firstObject()'s stringValue() as text
set end of aRecord to {Encoded_date:aValue}
end try
try
set aValue to (aNode's elementsForName:"Writing_application")'s firstObject()'s stringValue() as text
set end of aRecord to {Writing_application:aValue}
end try
try
set aValue to (aNode's elementsForName:"Writing_library")'s firstObject()'s stringValue() as text
set end of aRecord to {Writing_library:aValue}
end try
#======
try
set aValue to (aNode's elementsForName:"ID")'s firstObject()'s stringValue() as text
set end of aRecord to {|ID|:aValue}
end try
try
set aValue to (aNode's elementsForName:"Format_version")'s firstObject()'s stringValue() as text
set end of aRecord to {Format_version:aValue}
end try
try
set aValue to (aNode's elementsForName:"Format_settings__BVOP")'s firstObject()'s stringValue() as text
set end of aRecord to {Format_settings__BVOP:aValue}
end try
try
set aValue to (aNode's elementsForName:"Format_settings__Matrix")'s firstObject()'s stringValue() as text
set end of aRecord to {Format_settings__Matrix:aValue}
end try
try
set aValue to (aNode's elementsForName:"Format_settings__GOP")'s firstObject()'s stringValue() as text
set end of aRecord to {Format_settings__GOP:aValue}
end try
try
set aValue to (aNode's elementsForName:"Format_Settings_Wrapping")'s firstObject()'s stringValue() as text
set end of aRecord to {Format_Settings_Wrapping:aValue}
end try
try
set aValue to (aNode's elementsForName:"Bit_rate")'s firstObject()'s stringValue() as text
set end of aRecord to {Bit_rate:aValue}
end try
try
set aValue to (aNode's elementsForName:"Width")'s firstObject()'s stringValue() as text
set end of aRecord to {Width:aValue}
end try
try
set aValue to (aNode's elementsForName:"Height")'s firstObject()'s stringValue() as text
set end of aRecord to {Height:aValue}
end try
try
set aValue to (aNode's elementsForName:"Frame_rate")'s firstObject()'s stringValue() as text
set end of aRecord to {Frame_rate:aValue}
end try
try
set aValue to (aNode's elementsForName:"Standard")'s firstObject()'s stringValue() as text
set end of aRecord to {|Standard|:aValue}
end try
try
set aValue to (aNode's elementsForName:"Color_space")'s firstObject()'s stringValue() as text
set end of aRecord to {Color_space:aValue}
end try
try
set aValue to (aNode's elementsForName:"Chroma_subsampling")'s firstObject()'s stringValue() as text
set end of aRecord to {Chroma_subsampling:aValue}
end try
try
set aValue to (aNode's elementsForName:"Bit_depth")'s firstObject()'s stringValue() as text
set end of aRecord to {Bit_depth:aValue}
end try
try
set aValue to (aNode's elementsForName:"Scan_type")'s firstObject()'s stringValue() as text
set end of aRecord to {Scan_type:aValue}
end try
try
set aValue to (aNode's elementsForName:"Scan_order")'s firstObject()'s stringValue() as text
set end of aRecord to {Scan_order:aValue}
end try
try
set aValue to (aNode's elementsForName:"Compression_mode")'s firstObject()'s stringValue() as text
set end of aRecord to {Compression_mode:aValue}
end try
try
set aValue to (aNode's elementsForName:"Bits__Pixel_Frame_")'s firstObject()'s stringValue() as text
set end of aRecord to {Bits__Pixel_Frame_:aValue}
end try
try
set aValue to (aNode's elementsForName:"Stream_size")'s firstObject()'s stringValue() as text
set end of aRecord to {Stream_size:aValue}
end try
try
set aValue to (aNode's elementsForName:"Color_primaries")'s firstObject()'s stringValue() as text
set end of aRecord to {Color_primaries:aValue}
end try
try
set aValue to (aNode's elementsForName:"Transfer_characteristics")'s firstObject()'s stringValue() as text
set end of aRecord to {Transfer_characteristics:aValue}
end try
set end of planDates to aRecord
end repeat
planDates
Version 2 : It build a list of records
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
set theXMLFile to POSIX path of ((path to desktop as text) & "mediainfo.xml")
set theURL to current application's |NSURL|'s fileURLWithPath:theXMLFile
set {theXMLDoc, theError} to current application's NSXMLDocument's alloc()'s initWithContentsOfURL:theURL options:0 |error|:(reference)
if theXMLDoc = missing value then error (theError's localizedDescription() as text)
set {planEvents, theError} to theXMLDoc's nodesForXPath:"//Mediainfo/File/track" |error|:(reference)
if planEvents = missing value then error (theError's localizedDescription() as text)
set planDates to {}
repeat with aNode in planEvents
set aRecord to {Complete_name:missing value, Format:missing value, Commercial_name:missing value, Format_profile:missing value, Format_settings:missing value, File_size:missing value, Duration:missing value, Overall_bit_rate:missing value, Encoded_date:missing value, Writing_application:missing value, Writing_library:missing value, |ID|:missing value, Format_version:missing value, Format_settings__BVOP:missing value, Format_settings__Matrix:missing value, Format_settings__GOP:missing value, Format_Settings_Wrapping:missing value, Bit_rate:missing value, Width:missing value, Height:missing value, Frame_rate:missing value, |Standard|:missing value, Color_space:missing value, Chroma_subsampling:missing value, Bit_depth:missing value, Scan_type:missing value, Scan_order:missing value, Compression_mode:missing value, Bits__Pixel_Frame_:missing value, Stream_size:missing value, Color_primaries:missing value, Transfer_characteristics:missing value}
try
set aValue to (aNode's elementsForName:"Complete_name")'s firstObject()'s stringValue() as text
set Complete_name of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Format")'s firstObject()'s stringValue() as text
set Format of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Commercial_name")'s firstObject()'s stringValue() as text
set Commercial_name of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Format_profile")'s firstObject()'s stringValue() as text
set Format_profile of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Format_settings")'s firstObject()'s stringValue() as text
set Format_settings of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"File_size")'s firstObject()'s stringValue() as text
set File_size of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Duration")'s firstObject()'s stringValue() as text
set Duration of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Overall_bit_rate")'s firstObject()'s stringValue() as text
set Overall_bit_rate of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Encoded_date")'s firstObject()'s stringValue() as text
set Encoded_date of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Writing_application")'s firstObject()'s stringValue() as text
set Writing_application of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Writing_library")'s firstObject()'s stringValue() as text
set Writing_library of aRecord to aValue
end try
#======
try
set aValue to (aNode's elementsForName:"ID")'s firstObject()'s stringValue() as text
set |ID| of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Format_version")'s firstObject()'s stringValue() as text
set Format_version of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Format_settings__BVOP")'s firstObject()'s stringValue() as text
set Format_settings__BVOP of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Format_settings__Matrix")'s firstObject()'s stringValue() as text
set Format_settings__Matrix of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Format_settings__GOP")'s firstObject()'s stringValue() as text
set Format_settings__GOP of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Format_Settings_Wrapping")'s firstObject()'s stringValue() as text
set Format_Settings_Wrapping of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Bit_rate")'s firstObject()'s stringValue() as text
set Bit_rate of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Width")'s firstObject()'s stringValue() as text
set Width of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Height")'s firstObject()'s stringValue() as text
set Height of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Frame_rate")'s firstObject()'s stringValue() as text
set Frame_rate of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Standard")'s firstObject()'s stringValue() as text
set |Standard| of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Color_space")'s firstObject()'s stringValue() as text
set Color_space of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Chroma_subsampling")'s firstObject()'s stringValue() as text
set Chroma_subsampling of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Bit_depth")'s firstObject()'s stringValue() as text
set Bit_depth of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Scan_type")'s firstObject()'s stringValue() as text
set Scan_type of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Scan_order")'s firstObject()'s stringValue() as text
set Scan_order of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Compression_mode")'s firstObject()'s stringValue() as text
set Compression_mode of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Bits__Pixel_Frame_")'s firstObject()'s stringValue() as text
set Bits__Pixel_Frame_ of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Stream_size")'s firstObject()'s stringValue() as text
set Stream_size of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Stream_size")'s firstObject()'s stringValue() as text
set Stream_size of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Color_primaries")'s firstObject()'s stringValue() as text
set Color_primaries of aRecord to aValue
end try
try
set aValue to (aNode's elementsForName:"Transfer_characteristics")'s firstObject()'s stringValue() as text
set Transfer_characteristics of aRecord to aValue
end try
set end of planDates to aRecord
end repeat
planDates
Both are built upon a sample posted by Shane Stanley in https://macscripter.net/viewtopic.php?pid=188768
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 27 avril 2019 23:05:56