Hello I'm building an iPhone app in Appcelerator Titanium and one feature I'd like to add is forum support for a SMF 2.0 forum. I've installed the Tapatalk API on the forum and have successfully got my app sending an XML-RPC request and retrieving a massive XML-RPC result with all the root forum information. However I've had no luck finding a XML-RPC parser开发者_C百科 for Javascript. I'd like to able to just feed the response to a library and get back an array with each member and sub-member indexed appropriately. Does anyone know of such a library or even a better way to get SMF forum information in an XML format? Thanks.
I don't know such a library, but, XML-RPC is, well, XML, with pretty simple structure. And there are at least 3 approaches in modern javascript you can use to fetch data from xml:
- using pure DOM -
responseXML.documentElement.getElementByTagName('param')
and so on. - using XSLT proc
using Xpath (via document.evaluate)
Also, you can take any js xml/xsl/xpath library aimed to mitigate issues related to portability and so on.
Nevertheless, yes, it is not so trivial task to handle XMLRPC - there are integers, dates and some other subtle issues. But a 90-95% perfectness can be reached pretty fast)
精彩评论