homepage Welcome to WebmasterWorld Guest from 54.205.59.78
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP REST and XML
How to parse an APIs REST response?
johnnyboyct




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

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




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

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




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

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 :-)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved