We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The output tends to generate a XML document with more than one root node if the return values are not carefully encapsulated to avoid this.
One potential solution could be to detect the presence of multiple elements in the root array, and use a wrapping element to wrap them.
For comparison/testing, here is one such test case: Controller:
class EmptyTest { /** * @name EmptyTest * @description Returns a bunch of empty/null values * * @url GET /empty */ public function emptyTest() { return array( 'message' => 'Hello World!', 'test' => 0, 'test2' => "0", 'test3' => false, 'text' => null, 'string' => array(), 'texts' => null, 'strings' => array(), 'arrs' => array('hi', 'hi2') ); } }
JSON:
{ "message":"Hello World!", "test":0, "test2":"0", "test3":false, "text":null, "string":[], "texts":null, "strings":[], "arrs":[ "hi", "hi2" ] }
XML:
<?xml version="1.0"?> <message>Hello World!</message> <test>0</test> <test2>0</test2> <test3></test3> <text></text> <string></string> <texts></texts> <strings></strings> <arrs> <arr>hi</arr> <arr>hi2</arr> </arrs>
The text was updated successfully, but these errors were encountered:
Solution: Write a few generic API Response wrapper objects, which would allow correct exporting of both json, and xml.
Now to write it up.
Sorry, something went wrong.
#97: Wrap multiple-root XML responses with a <response> root tag
a26a3bd
Moving to version 1.3.0
No branches or pull requests
The output tends to generate a XML document with more than one root node if the return values are not carefully encapsulated to avoid this.
One potential solution could be to detect the presence of multiple elements in the root array, and use a wrapping element to wrap them.
For comparison/testing, here is one such test case:
Controller:
JSON:
XML:
The text was updated successfully, but these errors were encountered: