You need to sign in to do that
Don't have an account?
Sapana W
formatted xml
I want to generate a formatted xml output. Currently what am getting is as below:
620 SW 5th Avenue Suite 400 Portland, Oregon 97204United States 345 Shoreline Park Mountain View,CA USA USA
I want xml output as:
<Street>620 SW 5th Avenue Suite 400</Street>
<City>Portland</City>
<State>Oregon</State>
<PostalCode>97204</PostalCode>
<Country>USA</Country>
and so on..
Heres my code:
<apex:page StandardController="Account" recordSetVar="Accounts" contentType="text/xml" showHeader="true" 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}">
<Address type="Billing">
<Street><stri>{!eachAccount.billingStreet}</stri></Street>
<City>{!eachAccount.billingCity}</City>
<State>{!eachAccount.billingState}</State>
<PostalCode>{!eachAccount.billingPostalCode}</PostalCode>
<Country>{!eachAccount.billingCountry}</Country>
</Address>
</Account>
</apex:repeat>
</response>
</apex:page>
620 SW 5th Avenue Suite 400 Portland, Oregon 97204United States 345 Shoreline Park Mountain View,CA USA USA
I want xml output as:
<Street>620 SW 5th Avenue Suite 400</Street>
<City>Portland</City>
<State>Oregon</State>
<PostalCode>97204</PostalCode>
<Country>USA</Country>
and so on..
Heres my code:
<apex:page StandardController="Account" recordSetVar="Accounts" contentType="text/xml" showHeader="true" 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}">
<Address type="Billing">
<Street><stri>{!eachAccount.billingStreet}</stri></Street>
<City>{!eachAccount.billingCity}</City>
<State>{!eachAccount.billingState}</State>
<PostalCode>{!eachAccount.billingPostalCode}</PostalCode>
<Country>{!eachAccount.billingCountry}</Country>
</Address>
</Account>
</apex:repeat>
</response>
</apex:page>
@SFDC Developer:
Instead of "<" and ">" symbols use html characters "<" ">" and use <br/> to break line at end of each line so that it looks as the desired output.
Hope this helps:
Thanks,
Very thanks for your reply...
But I still get the same output...
2334 N. Michigan Avenue, Suite 1500 Chicago, IL 60601, USA
How to resolve this?
Heres the code:
<apex:page StandardController="Account" contentType="text/xml" showHeader="true" sidebar="false" cache="false">
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<Enquiry id="{!Account.id}" name="{!Account.name}">
<Address>
<![CDATA[
<Street>{!eachAccount.billingStreet}</Street>
<city>{!eachAccount.billingCity}</City>
..
..
..
]]>
</Address>
</Enquiry>
</response>
</apex:page>
The output is:
<Street>620 SW 5th Avenue Suite 400</Street><City>Chicago</City>..
But how to put them in seperate lines??? I used \n, <br/> ,
,
 , but neither worked..
Im not sure why you didnt get it! here is what i used:
<apex:repeat value="{!AccountList}" var="Account">
<Address> <br/>
<Name> {!Account.Name} <Name><br/>
</Address><br/>
</apex:repeat>
For which i got:
Hope this helps:
Thanks,
Balaji
Could you paste your VF code here? I am still unable to get desired output.