php write xml or json form format

Hi,

I want to use php write xml or json format that load in the loadStruct of form.
Could you tell me how can I do it.
Thanks.

test.php

[code]<?php

echo’

<item type="image" name="image_path" label="BR Copy" disabled="true" imageWidth="300" imageHeight="300" offsetTop="50" />

';

?>[/code]

myForm4 = myLayout2.cells(“c”).attachForm();
myForm4.loadStruct(“test.php”);