Jump to content

_XMLDomWrapper xml values to variable


Recommended Posts

Hello, firstly I'm sorry for my english :ermm:

I have a problem with _XMLDomWrapper

I want to get all values from xml file and attribute to the variable.

My .xml file:

http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/driver/NFSDREW/cars?shard=Apex

So I want get all attributes like:

$carId = carId

$make = make

$carName = carName

$acceleration = acceleration

$handling = handling

$rating = rating

$topSpeed = topSpeed

$carClass = carClass

 

I can do this in php but in AutoIT I have problems ;/

 

 

Link to comment
Share on other sites

I do this:

_SetDebug (True);show debug messages via console write
#include <_XMLDomWrapper.au3>
#include <Inet.au3>
#include <Array.au3>
#RequireAdmin
;$source = _inetgetsource("http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/driver/NFSDREW/cars?shard=Apex")

$Xml = ""
$Xml = _XMLFileOpen("http://world.needforspeed.com/SpeedAPI/ws/game/nfsw/driver/NFSDREW/cars?shard=Apex")


$count = _XMLGetNodeCount ("//list/*")


Dim $aAttrName[1], $aAttrValue[1], $node
for $x= 1 to $count
$node = _XMLGetAllAttrib ("/list/*["&$x-1&"]",$aAttrName,$aAttrValue )
$node1 = _XMLGetAllAttrib ("/list/*["&$x-1&"]/*",$aAttrName,$aAttrValue )

_ArrayDisplay($node," worldCar Value")
_ArrayDisplay($node1," physicsProfile Value")
;_ArrayDisplay($aAttrName,"Attrib Names")
;_ArrayDisplay($aAttrValue,"Attrib Value")




$node = _XMLGetAttrib("/list/*["&$x-1&"]/*","name",'[@id='&$x&']')
MsgBox(0,"Name Where Id="&$x,$node)
if @error then ExitLoop
Next
Exit

This works and shows me all values in array but I need to put this to table (all of them), so this should looks something like this:

[car id][make][model][acceleration][handling][topspeed][rating][class]

[9090][NISSAN][sILVIA (S15)][280][332][269][293][carclass_d]

[3309990][AUDI][R8 4.2 FSI QUATTRO][632][374][621][542][carclass_b]

etc.

btw. Thanks for answer

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...