+ Start a Discussion
Irish2013Irish2013 

xml data in vf pages jscript method

Hi,
how to build xml data in vf page to pass it into jscript method.

I need to build XML data in vf page. please help
Shashikant SharmaShashikant Sharma
Hi,

You could achieve it by making contenttype of your page text/xml

Like in this example: 
<apex:page StandardController="Account" recordSetVar="Accounts" contentType="text/xml" showHeader="false" sidebar="false" cache="false">
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<apex:repeat value="{!Accounts}" var="eachAccount" >
    <Account id="{!eachAccount.id}" name="{!eachAccount.name}">&
    <apex:repeat value="{!eachAccount.contacts}" var="eachContact">
        <Contact id="{!eachContact.id}" name="{!eachContact.name}" email="{!eachContact.email}"/>
    </apex:repeat>
    </Account>
</apex:repeat>
</response>

Thanks
Shashikant