Setting XML Object and Reusing It From Different Directories

V

vunet

Hello,
I am not able to load XML using Load method from child directory
(unlikely security issue). The function below sets xmlObj object once
and reuses this object every time it is accessed to loop through some
nodes. However, if I run this function from child directory, xmlObj
object contains no nodes even though it exists and loads XML without
errorCode. I achieved success if I set a new object (with new name)
but this would add complexity to my app and I want consistency to
reuse one object cross whole app. Please tell me what can be done in
my case and why xmlObj does not have children from child directory.


set xmlObj = nothing
function setAppXML ()
setAppXML = true 'default
if xmlObj is nothing then
Set xmlObj = Server.CreateObject("Microsoft.XMLDOM")
xmlObj .async = False
setAppXML = xmlObj.Load (Server.MapPath(PageDepth&"db/
appdata.inc"))
if xmlObj.parseError.errorCode > 0 then
setAppXML = false
resonse.write "Error parsing XML: "&xmlObj.parseError.errorCode
end if
end if
end function


''''''somewhere later I do
If setAppXML = true Then Set objConfig =
xmlObj.getElementsByTagName("config")
'BUT if I run function from any child directory then
objConfig.item(0).childNodes has NO NODES
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top