Hello Friends,

Just would like to share this code as it is working fine for me. This function returns the value of the Attributes of the Root Element of XML file.

</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Function GetRootElementAttributeValueFromXML(sFileNameWithP ath,sAttribute)

' Why we need to ADD 2 because each attribute followed by (=) and (&quot

iLenOfValue=len(sAttribute) + 2
Set doc = XMLUtil.CreateXML()
doc.LoadFile sFileNameWithPath
Set root = doc.GetRootElement()
If instr(1,root,sAttribute) &lt;= 0 then
Reporter.ReportEvent micFail,sAttribute,&quot;Not Found in XML file.&quot;
sStartPos=instr(1,root,sAttribute) + iLenOfValue
sEndPos=instr(sStartPos,root,&quot;&quot;&quot;&qu ot
GetRootElementAttributeValueFromXML=mid(root,sStar tPos,sEndPos - sStartPos)
end if
End Function

msgbox(GetRootElementAttributeValueFromXML(&quot;c :\temp\request.xml&quot;,&quot;MerchantId&quot)</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">

[ 05-10-2006, 07:17 AM: Message edited by: ppat7046 ]