Activity › Forums › Salesforce® Discussions › In Salesforce, We use XML file in Visualforce pages. What does this mean?
-
In Salesforce, We use XML file in Visualforce pages. What does this mean?
Posted by sushant on December 5, 2016 at 2:30 PMXML file in VisualForce Page
Satyakam replied 9 years, 5 months ago 2 Members · 1 Reply -
1 Reply
-
Hi sushant,
we can download xml file using contentType in visualforce page.
<apex:page controller=”TestController” contentType=”application/xml”>
……………………..
</apex:page>
we use xml file to upload in salesforce using visualforce page and apex controller.
Visualforce page-
<apex:page standardController="Account" extensions="attachmentsample"> <apex:form > <apex:sectionHeader title="Upload an Attachment"/> <apex:pageblock > <apex:pageblocksection columns="1"> <apex:inputfile value="{!myfile.body}" filename="{!myfile.Name}" /> <apex:commandbutton value="Save" action="{!Savedoc}"/> </apex:pageblocksection> </apex:pageblock> </apex:form> </apex:page>Apex Controller-
public class attachmentsample { public attachmentsample(ApexPages.StandardController controller) { } Public Attachment myfile; Public Attachment getmyfile() { myfile = new Attachment(); return myfile; } Public Pagereference Savedoc() { String accid = System.currentPagereference().getParameters().get('id'); Attachment a = new Attachment(parentId = accid, name=myfile.name, body = myfile.body); /* insert the attachment */ insert a; return NULL; } }This may help you to understand,why we use xml file in salesforce.
Thanks
-
This reply was modified 9 years, 5 months ago by
Satyakam.
-
This reply was modified 9 years, 5 months ago by
Log In to reply.