4 Replies Latest reply on Jun 20, 2007 2:38 PM by Newsgroup_User

    Another XML problem2

    wgb14 Level 1
      This is a script that Sean suggested in the first post of my XML problem:

      --
      --tNodeString = "<node as read in from your parsed XML>"
      tList = []
      nLines = tNodeString.line.count
      repeat with l = 1 to nLines
      tList.append(tNodeString.line[l])
      end repeat
      -- tList now holds individual lines of you original node

      Now my problem is as follows:

      Lets say that i parse these two nodes in the tnodestring

      have these two nodes:

      <Use_5_1>Hm, can i trust your judgement?
      Ok, but still I would prefer to choose what I want to see myself!
      I would like to ask you another question!</Use_5_1>

      <Use_5_3>Ok, but still I would prefer to what I want to see myself!
      No problem, you seem to know what you are doing, and I am sure that I will enjoy the tour!
      I would like to ask you another question!</Use_5_3>

      Using the script that Sean suggested will return me in a list ALL lines from both nodes. What i want to do is to extend the script to scan for dublicate lines (e.g.,I would like to ask you another question!) and return in the list only one of the two entries. Is there any way to do that? Again many many thanks for your valuable contributions so far! Your help is of great value to me!
        • 1. Re: Another XML problem2
          wgb14 Level 1
          Well, I would appreciate it if anyone has the solution for this! It will save me time from going over 1000 phrases and make sure that i have single pairs only!

          Many thanks
          • 2. Re: Another XML problem2
            Level 7
            I don't exactly get your question. But if the issue is xml parsing, you
            could have a look at:
            http://xtrema.rtr.gr/cDown/
            In there, you'll find a unicode xml to propList parser.
            You can use this movie to parse your xml data, or modify it to fit your
            needs.
            In order to use the list without the Xtra, you can use the .deref() method,
            and replace .deref() with .string, to add regular director strings to the
            list.


            "wgb14" <webforumsuser@macromedia.com> wrote in message
            news:f5bml4$dfq$1@forums.macromedia.com...
            > Well, I would appreciate it if anyone has the solution for this! It will
            > save me time from going over 1000 phrases and make sure that i have single
            > pairs only!
            >
            > Many thanks


            • 3. Re: Another XML problem2
              Level 7
              > --
              > --tNodeString = "<node as read in from your parsed XML>"
              > tList = []
              > nLines = tNodeString.line.count
              > repeat with l = 1 to nLines
              > tList.append(tNodeString.line[l])
              > end repeat
              > -- tList now holds individual lines of you original node

              --tNodeString = "<node as read in from your parsed XML>"
              tList = []
              nLines = tNodeString.line.count
              repeat with l = 1 to nLines
              tText = tNodeString.line[l]
              -- if the text is already in the list, skip adding it and
              -- move on to the next line of text
              if tList.getPos(tText) then next repeat
              tList.append(tText)
              end repeat
              • 4. Re: Another XML problem2
                wgb14 Level 1
                Although the link that you gave me is very interesting, this is not what i am trying to do! Let me rephrase: The script that Sean suggested allows me to read specific xml nodes and return the results as lists in director. What i am trying to do is to scan this list for dublicate lines and remove only one of the pair. For example, this is what the scipt returns when i parse some of my XML nodes.

                [Hm, can i trust your judgement?; Ok, but still I would prefer to choose what I want to see myself!; Ok, but still I would prefer to what I want to see myself!; I would like to ask you another question!]

                The above list contains two same lines ( Ok, but still I would...). I want to remove one of the two similar lines and write the resulting list in a cast member. In particular:

                [Hm, can i trust your judgement?; Ok, but still I would prefer to choose what I want to see myself!; I would like to ask you another question!]


                I hope it is clearer now!

                Many thanks