07-31-2009, 04:24 PM
It depends on the structure of your xml file. if the xml is like
then you can create a function to get xml values
Now you can set this value into your datatable.
Code:
<Variable id="FirstName">
<Value>Saket</Value>
</Variable>
<Variable id="LastName">
<Value>Kumar</Value>
</Variable>
then you can create a function to get xml values
Code:
Public Function GetXMLValue(XMLFile,VariableName)
'Declare local variables.
Dim objXMLDom
Dim objXMLRoot
Dim objXMLField
Set objXMLDom = CreateObject("Microsoft.XMLDOM")
objXMLDom.async = false
objXMLDom.load(XMLFile)
Set objXMLRoot = objXMLDom.documentElement
Set objXMLField = objXMLRoot.selectSingleNode("Variable[@id='" & Trim(VariableName) & "']/Value")
strValue = objXMLField.Text
GetXMLValue = trim(strvalue)
End Function
Code:
XMLValue = GetXMLValue("C:\File.xml","FirstName")
Now you can set this value into your datatable.