3 Replies Latest reply on May 27, 2007 6:09 PM by wgb14

    An XML problem

    wgb14 Level 1
      Hi all,

      I wonder if you can help me with that! I have the following script that loads an xml file based on the value of the xmlopen variable.

      global gFileIO,gmain,xmlopen

      on startmovie

      fileopen -- decide which of the xml files to open

      global gFileIO
      gFileIO = new(xtra "FileIO")
      gFileIO.openFile(the moviePath & "XML\"&xmlopen&"" & ".xml", 1)
      tXMLStr = gFileIO.readFile()
      gFileIO.closeFile()
      gFileIO = VOID
      global gXMLObj
      gXMLObj = new(xtra "XMLParser")
      gXMLObj.parseString(tXMLStr)
      global gmain
      gmain = gXMLObj.makeList()
      gXMLObj = VOID

      Loading is OK but my problem is when i am trying to access the xml root node (which each time has the same name as the xml variable). For example:

      If xmlopen = Architecture_Pr then root node = Architecture_Pr

      Based on the above logic director should accept the following string

      member("container").text = gmain[1].xmlopen.locD_Intro_A["!CHARDATA"]. But unfortnately not! It returns an error. Is there any way to declare xmlopen as a variable so director will not confuse it as a node name?

      Many thanks
        • 1. Re: An XML problem
          Level 7
          > member("container").text = gmain[1].xmlopen.locD_Intro_A["!CHARDATA"]. But
          > unfortnately not! It returns an error. Is there any way to declare xmlopen as a
          > variable so director will not confuse it as a node name?

          If I understand your issue correctly, then you should be using something
          like:
          member("container").text = (gmain[1][xmlopen]).locD_Intro_A["!CHARDATA"]
          Or:
          member("container").text = gmain[1][xmlopen]["locD_Intro_A"]["!CHARDATA"]
          • 2. Re: An XML problem
            Level 7
            Also, you might want to try:
            gMain = gXMLObj.makePropList()
            instead of 'makeList()' and see if it makes the data returned more
            manageable
            • 3. Re: An XML problem
              wgb14 Level 1
              Sean Many thanks

              As always you are my hero!!! Many thanks