On Tue, Jan 31, 2012 at 6:10 PM, Neil Kandalgaonkar <[email protected]> wrote:
> On 1/31/12 8:06 AM, Roan Kattouw wrote:
>>  I hate having to continue
>> support for XML because it limits the keys you can use in all sorts of
>> ways.
>
> Right. I'm assuming here that the XML serializer makes some assumptions
> about arrays and so on and how to transform them into nested tags. Which
> are failing.
>
Yes. Specifically, you will get broken XML output if you specify
invalid keys (like keys with spaces), and you'll get an exception if
you have arrays with numerical keys without having set an indexed tag
name...

>> I can't tell you exactly what's going wrong unless you can give me a
>> full dump of the relevant PHP data structure
>
> Please avoid solutions where your presence is required to solve a problem.
>
...but the error you reported is something I've never seen before, so
I'm offering to debug it based on the provided input.

> Wikidom is still a moving target. Let's just assume it has to be an
> arbitrary data structure. And one that I'd rather not have to update the
> API for every time we change it.
>
As long as the keys are reasonable (i.e. are valid as XML tags and
attributes), you'll be fine with some indexed tag name mangling. But
the error message you got suggests you gave it something very weird.

Maybe you gave it an object instead of an array, because you forgot to
pass true as the second argument to json_decode()/FormatJson::decode()
?

> Probably not. The other option is to stringify it, as the API sometimes
> does with returned XML.
>
> But then you have quoted JSON in JSON, and that seems stupid too.
>
Yeah, JSON stringification is probably the sanest thing to do, but
yeah the JSON-in-JSON thing is stupid.

Roan

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to