on mouseUp
loadPreferences
end mouseUp
command loadPreferences
local tTree
put readPreferencesToXMLTree() into tTree
if tTree is empty then
exit loadPreferences
end if
processPreferencesTree tTree
revDeleteXMLTree tTree
end loadPreferences
private function readPreferencesToXMLTree
set the itemDelimiter to slash
local tPreferencesFile
put the URL"http://htp2.hitecpoint.in:98/api/blackbox/live/45" into tPreferencesFile
local tPreferencesData, tResult
put tPreferencesFile into tPreferencesData
put the result into tResult
if tResult is not empty then
answer error "Failed to read preferences file at location: " & tPreferencesFile
return empty
end if
local tTree
put revCreateXMLTree(tPreferencesData, false, true, false) into tTree
if tTree is not an integer then
answer error "Failed to process preferences file with error: " & tTree
return empty
end if
return tTree
end readPreferencesToXMLTree
private command processPreferencesTree pTree
local tPosts
put revXMLChildNames(pTree, "ArrayOfLiveStatus/LiveStatus", return, "Location", true) into tPosts
local tListOfNames
repeat for each line tName in tPosts
put revXMLNodeContents(pTree, "ArrayOfLiveStatus/LiveStatus" & tName) & return after tListOfNames
end repeat
delete the last char of tListOfNames
local tOutput
put tListOfNames after tOutput
set the text of field "NameList" to tOutput
end processPreferencesTree
Я использую LiveCode software.I я доступ к вебу-API «http://htp2.hitecpoint.in:98/api/blackbox/live/45», которые возвращают XML data.I хотят, чтобы разобрать узел определения местоположения, но я всегда получаю ошибку "xmlerr, не может найти элемент ". Что я делаю неправильно, пожалуйста, помогите.Как парсер XML в LiveCode
Я только что ответил на этот же вопрос по программированию LiveCode для настоящих начинающих вопросов и ответов. – Mark