PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Extracting XML data through direction of an array of strings
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Extracting XML data through direction of an array of strings

  1. #1
    Member
    Join Date
    Jul 2000
    Location
    Atlanta
    Posts
    93

    Extracting XML data through direction of an array of strings

    Im currently trying to make an abstract method for reading xml data as parsing different formats is a pain in the butt. Especially with components I want to be reusable.

    currently I'm having an issue with dynamically grabbing data from the xml and just don't know if this is possible.

    Actionscript Code:
    for (var i:int=0; i<Properties.length; i++)
                        {
                            var a:String = Properties[i];
                            var b:String = Locations[i];
                           
                            //var value = obj.asset_groups.asset_group.@id;
                            var value = obj[b];
                           
                            populatedObject[a]=value;
                        }

    So currently the object is setting the variable name correctly from the Properties array... the location from the object (which is an XML) is in Locations....

    so obj.asset_groups.asset_group.@id does return the correct value, however converting that same value to a string, stuffing it in an array and referencing the array gives me nothing.

    var b = ".asset_groups.asset_group.@id";
    obj[b] (nothing)
    obj.[b] //compile error
    etc....

    obj.asset_groups.asset_group.@id returns the value if i type it out....

    Thanks for the help
    -Russ

  2. #2
    Member
    Join Date
    Jul 2000
    Location
    Atlanta
    Posts
    93
    perhaps a point in the right direction?

  3. #3
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,379
    toString() should give you the value within the tags. Calling the tag by name returns an XMLList if I remember correctly. If not I'd say it's a scope error.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  4. #4
    Member
    Join Date
    Jul 2000
    Location
    Atlanta
    Posts
    93
    Quote Originally Posted by ImprisonedPride View Post
    toString() should give you the value within the tags. Calling the tag by name returns an XMLList if I remember correctly. If not I'd say it's a scope error.
    Currently im running Flex inside of the Eclipse IDE and at the breakpoint the XMLList is empty. I wish it was that easy. Currently im looking for the syntax to do something of this nature......

    Actionscript Code:
    var tmp:String = "asset_groups.asset_group.@id";
                            var value = obj.tmp;

    since

    value = obj.asset_groups.asset_group.@id;

    does work im trying to create an eval of some sort for the string'd version

    value = obj[string variable location of element or attribute]

    or something along those lines.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center