2 Replies Latest reply on Jun 21, 2006 5:31 PM by Newsgroup_User

    best practices question

    redknot
      Quick question. I am writing some code to parse xml. I have been given an xml document that uses a lot of keywords in Flash as attribute names. .e.g. <someNode name= "Gretchen" length= "4s"> <someNode>

      So when I parse it....

      myXml.firstChild.attributes.name I am using a keyword "name" unintentionally.

      Should I be concerned about this? i.e. is it worth revamping the xml doc?

      Thanks in advance.

      LC
        • 1. Re: best practices question
          Rothrock Level 5
          I don't know for sure. But it seems like even if it worked it would be kinda confusing. I have done it on occasion but only with one word or so.

          Does it seem to be working?
          • 2. Re: best practices question
            Level 7
            name is not a keyword

            you might have a problem with length

            No need to revamp the xml doc anyway .. simple use [] notation to avoid any
            possible conflicts

            eg

            myXml.firstChild.attributes["name"]
            myXml.firstChild.attributes["length"]

            even if the attribute was something really nasty like "if" you could still
            use

            myXml.firstChild.attributes["if"]
            --
            Jeckyl