I have read one of the question here in stackoverflow and one of the user share this link by @Mifas and @Abhishek Madhani and this is working.
Now, I want to format the xml output like this:
<Form xmlns="url" label="Home Visit Form" type="TextView" name="FormName">
    <Field name="Category" label="FormType" value="Form1" type="TextView"/>
    <Field type="Delimiter"/>
    <Field name="ContractNumber" label="Contract number" value="3300000011" type="TextView"/>
    <Field type="Delimiter"/>
    <Field name="ClientName" label="Name of Client" value="Neplatic Neplaticovic" type="TextView"/>
    <Field name="BirthDate" label="Birthday" value="1980-07-04" type="TextView"/>
    <Field name="DueDate" label="Due Date" value="2014-07-24" type="TextView"/>
</Form>
But I don't know how.
PHP:
header('Content-Type: text/xml');
$Form= array(
    0 => array(
        'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
        'xsi:noNamespaceSchemaLocation' => 'http://homecredit.net/muchserver/ws/visit/types',
        'label'=> 'Home Visit Form',
        'type' => 'TextView',
        'name' => 'HomeVisitForm'
    ),
    1 => array(
        'id'    =>  '002',
        'name'  =>  'Ijas',
        'subjects'  => array('Science','History','Social')
    )
);
// creating object of SimpleXMLElement
$xml_Form = new SimpleXMLElement("<?xml version=\"1.0\"?><Form></Form>");
array_to_xml($Form,$xml_Form);                  // function call to convert array to xml
print $xml_Form->asXML();                               //saving generated xml file
 // function defination to convert array to xml
function array_to_xml($Form, &$xml_Form) {
    foreach($Form as $key => $value) {
        $key = is_numeric($key) ? "Field$key" : $key;
            (is_array($value))             
                ? array_to_xml($value, $xml_Form->addChild("$key"))
                : $xml_Form->addChild("$key","$value");
    }
}
?>
Output of the PHP code above:
<Form>
    <Field0>
        <xsi>http://www.w3.org/2001/XMLSchema-instance</xsi>
        <noNamespaceSchemaLocation>url</noNamespaceSchemaLocation>
        <label>Home Visit Form</label>
        <type>TextView</type>
        <name>HomeVisitForm</name>
    </Field0>
    <Field1>
        <id>002</id>
        <name>Ijas</name>
        <subjects>
            <Field0>Science</Field0>
            <Field1>History</Field1>
            <Field2>Social</Field2>
        </subjects>
    </Field1>
</Form>
 
     
    