Sub UploadKMLFile(fileObj As Map)
'get the file details
Dim fileDet As FileObject
fileDet = BANanoShared.GetFileDetails(fileObj)
'get the file name
Dim fn As String = fileDet.FileName
fn = fn.tolowercase
'only process kml files
If fn.EndsWith(".kml") = False Then Return
'read the file contents as text
Dim kmlText As String = BANano.Await(vuetify.GetFileAsText(fileObj))
'convert to xml Doc
'var xmlDoc = (new DOMParser()).parseFromString(text, 'text/xml');
Dim domParser As BANanoObject
domParser.Initialize2("DOMParser", Null)
Dim xmlDoc As BANanoObject = domParser.RunMethod("parseFromString", Array(kmlText, "text/xml"))
'read the docID and docName
Dim kmlList As List = xmlDoc.RunMethod("getElementsByTagName", "kml")
Dim doc_id As String = kmlList.Get(0).As(BANanoObject).RunMethod("getElementsByTagName", "Document").As(List).Get(0).As(Map).Get("id")
Log(doc_id)
Dim childNodes As List = kmlList.Get(0).As(BANanoObject).RunMethod("getElementsByTagName", "name").As(List).Get(0).As(BANanoObject).GetField("childNodes").As(List)
Dim doc_name As String = childNodes.Get(0).As(BANanoObject).GetField("textContent").Result
Log(doc_name)
End Sub