XML To Array

Terry Judd terry.judd at unimelb.edu.au
Tue Jul 2 21:44:21 EDT 2019


So admittedly I have modified Trevor's code a bit (mainly so I don't get the @ symbols associated with parameters but also so that instead of ["someNode[1]"] I get ["someNode"][1],  but for me that XML snippet creates an array that looks like...

["combine"]["class"] = TV_show
["combine"]["sources"]["agent"][1] = com.plexapp.agents.none
["combine"]["sources"]["agent"][2]  = com.plexapp.agents.localmedia

...which seems ok?

Terry...

On 3/7/19, 9:17 am, "use-livecode on behalf of Mark Wieder via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:

    
    What are you hoping to get out of xml-to-array? Given that keys aren't 
    guaranteed to be unique, I think what you're seeing there makes sense. 
    Otherwise you'll stand the chance of losing data in translation. If you 
    don't convert to a numeric form with a concordance, as Trevor has done, 
    I don't see you you could possibly convert this xml to an array:
    
    <combine class="TV_Show">
         <sources>
             <agent>com.plexapp.agents.none</agent>
             <agent>com.plexapp.agents.localmedia</agent>
         </sources>
    </combine>
    
    -- 
      Mark Wieder
      ahsoftware at gmail.com
    
    _______________________________________________
    use-livecode mailing list
    use-livecode at lists.runrev.com
    Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
    http://lists.runrev.com/mailman/listinfo/use-livecode
    
    



More information about the Use-livecode mailing list