function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sanjay dubey 19sanjay dubey 19 

how to download the generated xml after click on button

hello friends 
i have generated xml for account rocord but my requirement is that when user click on a button the generated xml will download in local machine 
please suggest me 
my vf page 

<apex:page Controller="AllAccount"contentType="application/xml" readOnly="true" showHeader="false" sidebar="false" cache="false">
<?xml version="1.0" encoding="UTF-8" ?>    
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://nsi.dk/-/stamdata/3.0/dkma" targetNamespace="http://nsi.dk/-/stamdata/3.0/dkma">
<xs:element name="DEXFileUpload" type="DEXFileUpload">
   <xs:complexType name="DEXFileUpload">
     <xs:all>
     <apex:repeat value="{!TheAccount}" var="eachAccount" >
     <xs:choice minOccurs="1" maxOccurs="5"/>
    <Account>
    <xs:complexType name="Account Basic information">
        <xs:sequence>
            <xs:element name="{!eachAccount.name}" type="{!eachAccount.type}"/>
            <xs:element type="{!eachAccount.type}"/>
            <xs:element Fax= "{!eachAccount.Fax}"/>
            <xs:element Industry= "{!eachAccount.Industry}"/>
            <xs:element AnnualRevenue= "{!eachAccount.AnnualRevenue}"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Address information">
    <xs:sequence>
       <xs:element billingcity= "{!eachAccount.billingcity}" maxOccurs="unbounded" minOccurs="0"/>
       <xs:element billingcity= "{!eachAccount.billingCountry}"/>
    </xs:sequence>
    </xs:complexType>
    </Account>
      </apex:repeat>
      </xs:all>
   </xs:complexType>
 </xs:element>
</xs:schema>
</apex:page>
  

controller

 public class AllAccount {

    public List<Account> getTheAccount() {
       List<Account> theAllAccount = 
            [SELECT Name,type,AnnualRevenue,billingcity,BillingCountry,Fax,Industry FROM Account];
        return(theAllAccount);
    }
}

that produce the output this 

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<xs:schema xmlns:tns="http://nsi.dk/-/stamdata/3.0/dkma" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://nsi.dk/-/stamdata/3.0/dkma">
<xs:element name="DEXFileUpload" type="DEXFileUpload">
<xs:complexType name="DEXFileUpload">
<xs:all>
<xs:choice maxOccurs="5" minOccurs="1"/>
<Account>
<xs:complexType name="Account Basic information">
<xs:sequence>
<xs:element name="test Household" type="Household"/>
<xs:element type="Household"/>
<xs:element Fax=""/>
<xs:element Industry=""/>
<xs:element AnnualRevenue=""/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Address information">
<xs:sequence>
<xs:element billingcity="" maxOccurs="unbounded" minOccurs="0"/>
<xs:element billingcity=""/>
</xs:sequence>
</xs:complexType>
</Account>
</xs:schema>
my requirement is that when i click on button it downloaded .

thanks in advance 
sanjay