[email protected] schreef:
> I notice a lack of a format: indented, real xml
>
> $ w3m -dump 
> 'http://transgender-taiwan.org/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xmlfm'
>  |
> sed '/^</,$!d' > What_I_want.xml
>
> $ wget -O Almost_what_I_want_but_somebody_stripped_all_the_indentation.xml \
> 'http://transgender-taiwan.org/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml'
>
> I.e., if dumpBackup.php and Special:Export produce it, so should the API.
First, for the record, non-indented XML without newlines is just as 
'real' as indented XML.

Non-fm formats are not indented because they're not meant for display, 
and because stripping indentation reduces the size of the output, saving 
bandwidth (it may not seem like much for one small request like this 
one, but for many and/or large requests, it certainly makes a 
difference). Besides, bots don't (or at least shouldn't) care about 
indentation. The fm formats are indented and highlighted because they're 
meant to be used by humans, who do like indentation.

If your desire for indented XML is for viewing of downloaded XML, just 
open your XML file in Firefox. For other purposes, you could look for an 
XML prettifier, which I'm sure has to be available somewhere.

Roan Kattouw (Catrope)

_______________________________________________
Mediawiki-api mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to