0 Replies Latest reply on Oct 5, 2006 11:26 AM by mvierow

    The destruction of xmlParse created variables

    mvierow Level 1
      Like many of you, I use CFHTTP to return a XML formated document, then use xmlParse to create a ColdFusion variable so that I can directly access certain nodes. In some cases, I schedule this routine, then save the xmlParsed results into a persistent scope for later reference.

      I've begun fighting some odd errors lately, and only through elimination have I been able to find out any information on them. They are being generated when I attempt to access certain nodes, so I setup a cfdump to display the content of the entire scope when the problem occurs. The variable, which should contain my xmlParsed document, shows "[undefined struct element]" instead.

      The scheduled task, which runs at the top of every hour, is the only script that writes to that variable. It does so in between a set of CFLOCK tags, which lock exclusively for a name I've defined specifically for this part. All references to read that information are also locked read-only using the same name. The entire scope is not locked.

      When preparing to display the information, the script first checks for a particular node before doing anything, then confirms that there are children in that node using ArrayLen(). Both of these checks succeed despite the circumstances. As the script progresses through a CFLOOP routine parsing this array, the corruption is eventually encountered and an error thrown.

      These errors can occur at any time, but never in coordination with the scheduled task. The variable remains valid, then for whatever reason suddenly turns to "undefined struct element". Till this point, my only solution has been to rewrite the scheduled task, storing the xmlParsed variable in the request scope temporarily, then build an array of my own to store the data that I need. For whatever reason accessing the data in this format is free of the issue.

      I should also note that variables I create using CFXML do not have this issue, although I guess I should add that these are all stored in the session scope, whereas the xmlParse vars are being stored in the application scope.

      Has anyone else encountered this issue? Anyone else persist xmlParsed variables with any success?

      CFMX 7,0,0,91690 and 7,0,2,142559 on Windows.