For our use case, rest_server's XML formatter didn't output entirely accurate XML. Numeric arrays should be formatted as repeated tags, rather than inside "item" tags.

For example, if you have custom values in $node, something like this:

$node->component['attribute'][0]['value'] = 'test0';
$node->component['attribute'][1]['value'] = 'test1';

The current XML formatter will display something like this:

<component>
  <attribute is_array="true">
    <item>
      <value>test0</value>
    </item>
    <item>
      <value>test1</value>
    </item>
  </attribute>
</component>

Whereas it "should" (at least for our use case) be like this:

<component>
  <attribute>
    <value>test0</value>
  </attribute>
  <attribute>
    <value>test1</value>
  </attribute>
</component>

The main reason this is important for us is because we're uploading XML files using a custom solution and turning them into nodes on the backend. We then need to generate exactly the same XML format for API queries.

Attached is a patch that accomplishes this. It does currently work for us, but I'm leaving this as "needs work" since I'm not sure how it may impact other people's implementations.

Thanks!

Comments

kylebrowning’s picture

Im for this idea but i need to spend some time getting an API version so that these like these can be updated.

We will definitely need to take into account if they choose to use this fix b/c it will break peoples clients.

Ill keep you posted.

kylebrowning’s picture

Status: Needs work » Closed (won't fix)

Wont fix in 3.x but ive added it as a list of things to do for 4.x