Jump to content

grabbing all attributes/values from xml file regardless of parent/child


dsaba

Recommended Posts

Hi I have this string of sample xml:

<?xml version="1.0" encoding="ISO-8859-1" ?><root>
    <Weapon Name="glock_third" BLS="3143051982">
        <File BLS="677817497" Type="0" Name="animations\weapons\third\glock\glock_3rd.max" />
        <File BLS="3238332844" Type="7" Name="animations\weapons\third\glock\glock_3rd.asc" />
        <File BLS="1034730079" Type="10" Name="gfx_muzzleflash.glock18_muzzle_flash.glock18_muzzle_flash_a" />
        <File BLS="2015063739" Type="10" Name="gfx_bullets_cases.gfx_bullets_cases_glock.gfx_bullets_cases_glock" />
        <File BLS="3401955303" Type="1" Name="objects_ctnr\weapons\bullet_tracer\bullet_tracer03.bmp" />
    </Weapon>
    <Mesh Name="animations\weapons\third\glock\glock_3rd.max" BLS="677817497">
        <File Name="animations\weapons\third\glock\glock_3rd.mac.mrg.bin" BLS="3983458953" Type="5" />
        <File Name="animations\weapons\third\glock\glock_18_3rd.bmp" BLS="2827076309" Type="1" />
    </Mesh>
    <AnimPackage Name="animations\weapons\third\glock\glock_3rd.asc" BLS="3238332844" />
    <Mesh Name="animations\weapons\first\deserteagle\deserteagle_muzzle_flash.max" BLS="2291656067">
        <File Name="animations\weapons\first\deserteagle\deserteagle_muzzle_flash_a.bmp" BLS="3934442312" Type="1" />
        <File Name="animations\weapons\first\deserteagle\deserteagle_muzzle_flash_b.bmp" BLS="2904730008" Type="1" />
    </Mesh>
    <ParticleLibrary Name="gfx_muzzleflash.glock18_muzzle_flash.glock18_muzzle_flash_a" BLS="1034730079">
        <File Name="animations\weapons\first\deserteagle\deserteagle_muzzle_flash.max" BLS="2291656067" Type="0" />
        <File Name="textures_ctnr\sprites\gfx_smoke_d.bmp" BLS="3395818157" Type="1" />
    </ParticleLibrary>
    <Mesh Name="animations\weapons\bullets_cases\9x19mm_casing.max" BLS="1065635830">
        <File Name="animations\weapons\bullets_cases\ammunition.bmp" BLS="1603004763" Type="1" />
    </Mesh>
    <ParticleLibrary Name="gfx_bullets_cases.gfx_bullets_cases_glock.gfx_bullets_cases_glock" BLS="2015063739">
        <File Name="animations\weapons\bullets_cases\9x19mm_casing.max" BLS="1065635830" Type="0" />
        <File Name="textures_ctnr\sprites\gfx_smog.bmp" BLS="2597726557" Type="1" />
        <File Name="textures_ctnr\sprites\gfx_flare.bmp" BLS="1973412938" Type="1" />
    </ParticleLibrary>
</root>

 

 

basically i want to create some type of alogorithim to grab all NAME and BLS values within the same tag, the open tag will always be <, and the close tag maybe be /> or > , as you can see in the above sample

 

PLUS i want to do this from all xml tags, regardless of child/parent relationship in the tags

 

Is there a way to create such a loop with simpleXML ? I read in the manual but did not see any type of functionality, or perhaps some kind of regex could grab this?

 

-Thank You

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.