View Single Post
Old 01-16-2013, 10:13 PM   PM User | #1
aseylys
New to the CF scene

 
Join Date: Apr 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
aseylys is an unknown quantity at this point
Wolfram API XML Help

So I'm a little new to XML, I mean I get the gist of most of it I'm just no expert. So I'm writing this program that when asked a question it goes to the Wolfram API and asks it there, then Wolfram prints out an XML code containing the answer. Here's an example:
Question: Who is the president?
Answer:
Code:
<queryresult success="true" error="false" numpods="1" datatypes="City,Country,Leader,People,USState" timedout="" timedoutpods="" timing="1.096" parsetiming="0.191" parsetimedout="false" recalculate="" id="MSPa54631a4hg0e0c5496d8b000044bfi5giibia4e8i" auth="" host="http://www3.wolframalpha.com" server="31" related="http://www3.wolframalpha.com/api/v2/relatedQueries.jsp?id=MSPa54641a4hg0e0c5496d8b00001hefhhf2fe5fbe3g&s=31" version="2.6">
<pod title="Result" scanner="Data" id="Result" position="200" error="false" numsubpods="1" primary="true">
<subpod title="">
<plaintext>Barack Obama</plaintext>
</subpod>
</pod>
<sources count="2">
<source url="http://www.wolframalpha.com/sources/LeaderDataSourceInformationNotes.html" text="Leader data"/>
<source url="http://www.wolframalpha.com/sources/PeopleDataSourceInformationNotes.html" text="People data"/>
</sources>
</queryresult>
The answer is in the <plaintext> area. So I'm wondering if there was a way, after imputing the answer that if XML had a way of just giving me the answer, like a code that would only display what is between the <plaintext> & </plaintext>?
Anyone have any clues or suggestions? Help is greatly appreciated.
aseylys is offline   Reply With Quote