Windev should consider to provide an XLMToTable function so that I don't need to write this as a workaround.
See below:
// 14:16:38 Fri 9 Oct 2009 xml2memoryTable
// 14:44:51 Sat 10 Oct 2009
XMLDoc is string="XML"
XMLInfo is string
sXmlTable is string = "C:\1.xml"
sTableName is string
sDir is string=completeDir("c:\wd7\7") //Make your own DIR
sFile is string="dTable"
HCancelDeclaration(dTable)
TableDesc is file description
ItemDesc is item description
dTable is data source
fDelete(sFile+".fic")
fDelete(sFile+".ndx")
hDuplicateKey is int = 2062 //2061 for hUniqueKey
nSize is int = 40
// Description of the "dTable" file
TableDesc..Name = "dTable"
TableDesc..Type = hFileNormal
TableDesc..FicCryptMethod = hCryptStandard
XMLClose(XMLDoc) //Frees the XML document
// Load the XML file in a string
XMLInfo = fLoadText(sXmlTable)
// Initialize the XML functions on this file
XMLDocument(XMLDoc,XMLInfo)
// point to the root
XMLRoot(XMLDoc)
XMLFind(XMLDoc, null)
sTableName = XMLElementName(XMLDoc)
//trace("ParentName"+nElement+"="+ XMLElementName(XMLDoc) )
XMLChild(XMLDoc)
XMLFirst(XMLDoc)
//trace("elementName"+nElement+"="+ XMLElementName(XMLDoc) )
ItemDesc..Name = XMLElementName(XMLDoc)
ItemDesc..Type = hItemText
ItemDesc..Size = nSize
ItemDesc..KeyType = hDuplicateKey
HDescribeItem ( TableDesc , ItemDesc )
nElement is int = 1
XMLNext(XMLDoc)
WHILE NOT XMLOut(XMLDoc)
nElement = nElement + 1
ItemDesc..Name = XMLElementName(XMLDoc)
ItemDesc..Type = hItemText
ItemDesc..Size = nSize
HDescribeItem ( TableDesc , ItemDesc )
// trace("elementName"+nElement+"="+ XMLElementName(XMLDoc) )
XMLNext(XMLDoc)
END
HDeclareExternal(sDir+sFile+".fic", sFile)
HDescribeFile ( TableDesc )
HImportXML ( dTable , sXmlTable , hImpCreation )
//Make a DUMMY Memory table, a few columns will do, mine is a 3-column table
OpenChild("t=c:\wd7\wdw\t03.wdw")
BuildBrowsingTable("t.tbl", sFile,taFillTable) //t.tbl WDWname.TableName
HCancelDeclaration(sFile)
HClose(dTable)
//trace("Total # of Elements in "+ sTableName + " = " + nElement)
// Cancels the search for the other XML functions used thereafter
XMLCancelSearch(XMLDoc)
XMLClose(XMLDoc) //Frees the XML document