Welcome to WebmasterWorld Guest from 54.226.2.31

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP REST and XML

How to parse an APIs REST response?

     

johnnyboyct

5:56 pm on Sep 13, 2006 (gmt 0)

5+ Year Member



I started working with a few apis today to try a mashup. Ive never worked with rest before, and im having troubles finding help on how to parse the REST that the api sends to me.


<ResultSet xsi:schemaLocation="urn:search http://prices.xsd">
&#8722;
<Market id="51472" symbol="ADSRV2" name="Ad Services">
&#8722;
<Stock id="51473" symbol="CJ" name="Commission Junction">
<Price>7.10</Price>
<Change>0.00</Change>
</Stock>
</Market>
</ResultSet>

Im not sure if I should be treating it like regular xml, or if theres a particular way to treat the xml. I can parse it to the page, but I cant figure out how to get the properties and attribues out... For example, it outputs 7.00 and 0.00 but wont say the symbol ADSRV2 or any of the other info.
Does anyone have any experiance with this? From my reading such as »codewalkers.com/tutorials/50/6.html your not really supposed to take the id, symbol and name. Although I think the data is useless without it

Thanks, John

johnnyboyct

5:27 am on Sep 14, 2006 (gmt 0)

5+ Year Member



Anyone have any advice or can anyone point me to the right direction? Ive tried a few other sites forums, and no one seems to know anything about this, or maybe im asking wrong? Maybe move the post?

Anything at all appreciated.

Thanks, John

npang

5:32 am on Sep 14, 2006 (gmt 0)

10+ Year Member



i use DOMIT for all my XML parsing.

[engageinteractive.com...]

go through the examples and docs. you can parse the XMl and extract values and attributes. just take some visualization of the tree to get the correct nodes and then extracting the values or attributes.

good luck :-)

 

Featured Threads

Hot Threads This Week

Hot Threads This Month