1st way:-

<cfscript>

XmlData= ‘<?xml version=”1.0″ encoding=”UTF-8″?>

<FirstTag>
<FirstNestedTag>VALUE</FirstNestedTag>
<SecondNestedTag>VALUE</SecondNestedTag>
<ThirdNestedTag>VALUE</ThirdNestedTag>

</FirstTag>

<SecondTag>
<FirstNestedTag>VALUE</FirstNestedTag>
<SecondNestedTag>VALUE</SecondNestedTag>
<ThirdNestedTag>VALUE</ThirdNestedTag>
</SecondTag>

 

</script>

 

2nd way:

 

<cfxml variable=”XmlData”>
<?xml version=’1.0′ encoding=’utf-8′ ?>

<FirstTag>
<FirstNestedTag>VALUE</FirstNestedTag>
<SecondNestedTag>VALUE</SecondNestedTag>
<ThirdNestedTag>VALUE</ThirdNestedTag>

</FirstTag>

<SecondTag>
<FirstNestedTag>VALUE</FirstNestedTag>
<SecondNestedTag>VALUE</SecondNestedTag>
<ThirdNestedTag>VALUE</ThirdNestedTag>
</SecondTag>

</cfxml>

 

3rd way:

<cfsavecontent variable=”list”>
<FirstTag>
<FirstNestedTag>VALUE</FirstNestedTag>
<SecondNestedTag>VALUE</SecondNestedTag>
<ThirdNestedTag>VALUE</ThirdNestedTag>

</FirstTag>

<SecondTag>
<FirstNestedTag>VALUE</FirstNestedTag>
<SecondNestedTag>VALUE</SecondNestedTag>
<ThirdNestedTag>VALUE</ThirdNestedTag>
</SecondTag>
</cfsavecontent>
<cfset XmlData=XmlParse(list)>

 

Different ways to create Xml in coldfusion

Leave a Reply

Your email address will not be published.