Reading information from DDClasslist.xml
I'm using VDF15.1 and must read the information that is within the file DDClassList.XML of my workspace. I found a routine, examples of VDF, which reads the XML files and adapted to read the XML file and put data into an array of struct.
Code:
Struct tDDClassList
Integer TableNumber
String TableName
String ClassName
String ClassFile
End_Struct
Procedure LoadDDClassList
Handle hoXML hoRoot hoList hoCust
Integer iItems i iTableNumber
Boolean bOK
String sDdSrcPath
tDDClassList[] gDDClassList
Move (ResizeArray(gDDClassList, 0)) to gDDClassList
Get Create (RefClass(cXMLDOMDocument)) to hoXML
Get psDdSrcPath of (phoWorkspace(ghoApplication)) to sDdSrcPath
Get PathAtIndex of (phoWorkspace(ghoApplication)) sDdSrcPath 1 to sDdSrcPath
Set psDocumentName of hoXML to (sDdSrcPath - "\DDClasslist.xml")
Set pbValidateOnParse of hoXML to True
Get LoadXMLDocument of hoXML to bOK
If not bOK Begin
End
Else Begin
Get DocumentElement of hoXML to hoRoot
Get FindNodeList of hoRoot "Table" to hoList
Get NodeListLength of hoList to iItems
Decrement iItems
For i from 0 to iItems
Get CollectionNode of hoList i to hoCust
Get ChildNodeValue of hoCust "tableNumber" to iTableNumber
Get ChildNodeValue of hoCust "tableNumber" to gDDClassList[iTableNumber].TableNumber
Get ChildNodeValue of hoCust "tableName" to gDDClassList[iTableNumber].TableName
Get ChildNodeValue of hoCust "DDClasses/DDClass/className" to gDDClassList[iTableNumber].ClassName
Get ChildNodeValue of hoCust "DDClasses/DDClass/classFile" to gDDClassList[iTableNumber].ClassFile
Send Destroy to hoCust
Loop
Send Destroy to hoList
End
Send Destroy of hoXML
End_Procedure // LoadDDClassList
This routine only works perfectly if I delete the first and last line of the file DDClassfile.xml.
First Line: <DataDictionaryList xmlns="http://www.dataaccess.com/VisualData...ictionaryList/">
.
.
.
Last Line: </DataDictionaryList>
What should I change in my routine to be able to read the file DDClassList.XML without me having to change it??
Regards,
Edimar V. Bernardo