@@ -544,10 +544,9 @@ function process_one_file(path, full_file_name)
544544 if abort_if (not score_partwise , " file does not appear to be exported from Finale" ) then
545545 return
546546 end
547- local encoding_element = tinyxml2 .XMLHandle (score_partwise )
548- :FirstChildElement (" identification" )
549- :FirstChildElement (" encoding" )
550- :ToElement ()
547+ local information_element = tinyxml2 .XMLHandle (score_partwise ):FirstChildElement (" identification" ):ToElement ()
548+ local encoding_element = tinyxml2 .XMLHandle (information_element ):FirstChildElement (" encoding" ):ToElement ()
549+
551550 local software_element = encoding_element and encoding_element :FirstChildElement (" software" )
552551 local encoding_date_element = encoding_element and encoding_element :FirstChildElement (" encoding-date" )
553552 if abort_if (not software_element or not encoding_date_element , " missing required element 'software' and/or 'encoding-date'" ) then
@@ -561,9 +560,9 @@ function process_one_file(path, full_file_name)
561560 finaleplugin .Version .. " for " .. (finenv .UI ():IsOnMac () and " Mac" or " Windows" ))
562561 local original_encoding_date = encoding_date_element :GetText ()
563562 encoding_date_element :SetText (os.date (" %Y-%m-%d" ))
564- local miscellaneous_element = encoding_element :FirstChildElement (" miscellaneous" )
563+ local miscellaneous_element = information_element :FirstChildElement (" miscellaneous" )
565564 if not miscellaneous_element then
566- miscellaneous_element = encoding_element :InsertNewChildElement (" miscellaneous" )
565+ miscellaneous_element = information_element :InsertNewChildElement (" miscellaneous" )
567566 end
568567 local function insert_miscellaneous_field (name , value )
569568 local element = miscellaneous_element :InsertNewChildElement (" miscellaneous-field" )
0 commit comments