jpatokal / mediawiki-gateway

Ruby framework for MediaWiki API manipulation
Other
133 stars 50 forks source link

mw.get(pagetitle) returns HTML. Json? #27

Open paulmmay opened 12 years ago

paulmmay commented 12 years ago

Hello

Given that MediaWiki can return Json, XML and other more parseable formats - could you add this into the utils? It should be pretty straightforward.

Thanks

jpatokal commented 12 years ago

If it's that straightforward, send me a pull request ;)

aaronmase commented 12 years ago

+1

jpatokal commented 12 years ago

Since the smiley apparently wasn't enough: no, it's not that straightforward. The code currently assumes that API responses are always XML and parses them accordingly to check for errors, warnings, continuation etc etc. It's thus not possible to "just" return JSON, because the library has no capability to understand anything other than XML at the moment, and I don't see any easy way of adding such capability.

But again, if you think you can make this happen, code contributions are more than welcome.

aaronmase commented 12 years ago

I think XML is fine and retrieving it in other forms might be outside the scope of this gem in that case.