Setting XML Object and Reusing It From Different Directories

Discussion in 'ASP General' started by vunet, Mar 4, 2010.

  1. vunet

    vunet Guest

    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
     
    vunet, Mar 4, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oleg  Paraschenko
    Replies:
    0
    Views:
    396
    Oleg Paraschenko
    Jun 6, 2005
  2. Sophie PARISOT

    How to use different asmx in different sub-directories ?

    Sophie PARISOT, Feb 8, 2006, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    208
    Satish
    Feb 13, 2006
  3. Adam Petrie
    Replies:
    8
    Views:
    338
    Adam Petrie
    Oct 11, 2004
  4. Ron Smith
    Replies:
    5
    Views:
    168
    Michele Dondi
    Nov 2, 2004
  5. Jabba Laci
    Replies:
    1
    Views:
    135
    Roy Smith
    Oct 6, 2013
Loading...

Share This Page