Hi,
I want to read the text property of XML file.
My xml file is as follows:
I want to read the values of <user>,<passwor d> etc.
For reading these values, my code is as follows(in asp file):
My code failed at line "doc.GetElement sByTagName(tag) .item(0).text".
Earlier a long time back, This code was working fine.
But now giving error.
And also please tell me how to retreive the error description for this line in asp?
I have tried following options also:
1. doc.GetElements ByTagName(tag). item(0).childno des(0).text also
2. doc.selectsingl enode("/Domain_Credenti als/Host").text
But no luck.
Can anyone please help me how to read these values from given xml file?
Regards,
anu
I want to read the text property of XML file.
My xml file is as follows:
Code:
<?xml version="1.0"?> <Domain_Credentials> <User> anu </User> <Password> admin </Password> <SearchBaseDN> dc=def,dc=com </SerachBaseDN> <Host> abc.def.com</Host> </Domain_Credentials>
For reading these values, my code is as follows(in asp file):
Code:
file = "myfiles\DomainCredentials.xml"
file=Server.MapPath(file)
tag="Host"
Set fso =server.CreateObject("Scripting.FileSystemObject")
If fso.FileExists(file) Then
set doc = CreateObject("Microsoft.XMLDOM")
if err.number <> 0 or doc is nothing then
light_trace "error creating xmldom: " & err.description
else
light_trace "create xmldom ok"
end if
doc.async = "false"
doc.load(file)
if err.number <> 0 or doc is nothing then
light_trace "error loading xml file: " & err.description
else
light_trace "xml file load ok"
end if
Dim element
element=""
element=doc.GetElementsByTagName(tag).item(0).text
end if
Earlier a long time back, This code was working fine.
But now giving error.
And also please tell me how to retreive the error description for this line in asp?
I have tried following options also:
1. doc.GetElements ByTagName(tag). item(0).childno des(0).text also
2. doc.selectsingl enode("/Domain_Credenti als/Host").text
But no luck.
Can anyone please help me how to read these values from given xml file?
Regards,
anu
Comment