2 Replies Latest reply on May 14, 2007 6:04 AM by Greg Dove

    Adding data to an array

      I have an array populated from a parsed XML file. The XML file has a node representing an employee with attributes for "id", "tenure" , "phone" and "address". I want to be able to change the "id" attribute for a particular employee dynamically. Do I work with the array or is it better to affect the attribute in the xml doc , in which case I am clueless there as well so any help will be appreciated.
        • 1. Re: Adding data to an array
          kglad Adobe Community Professional & MVP
          you can do either. which is better depends upon your needs.
          • 2. Re: Adding data to an array
            Greg Dove Level 4
            Maybe this will help with some ideas. If you're intending to return the changed XML to a server then I'd suggest trying to work with the XML if you can.
            Just be aware that whenever you use arrays (either from childNodes property or from XPathAPI.selectNodeList method) you can work within the node (via reference) through array iteration, but you need to use the XMLNode methods to remove or add nodes, or (using insertBefore) change the sequence.