Parsing a remote XML feed using the CFFEED tag in ColdFusion

Readability

Parsing a remote XML feed using the CFFEED tag in ColdFusion

In a pre­vi­ous exam­ple, “Con­vert­ing a query into an XML feed using the CFFEED tag in Cold­Fu­sion”, we saw how you could con­vert a data­base query into an XML feed by using the and set­ting the action attribute to “create”.

The fol­low­ing exam­ple shows how you can parse a remote XML feed into an XML object using the <CFFEED> tag in Cold­Fu­sion by set­ting the action attribute to “read” and set­ting the source, and xmlVar attributes.




And the out­put of the <CFDUMP> tag is as fol­lows:
Parsing a remote XML feed using the CFFEED tag in ColdFusion

In a previous example, “Converting a query into an XML feed using the CFFEED tag in ColdFusion”, we saw how you could convert a database query into an XML feed by using the and setting the action attribute to “create”.

The following example shows how you can parse a remote XML feed into an XML object using the <CFFEED> tag in ColdFusion by setting the action attribute to “read” and setting the source, and xmlVar attributes.

<cffeed action="read"
        source="http://coldfusionexamples.com/feed/"
        xmlVar="cfexamples" />
 
<cfdump var="#xmlParse(cfexamples)#" />

And the output of the <CFDUMP> tag is as follows:
Parsing a remote XML feed using the CFFEED tag in ColdFusion

Leave a Reply

Your email address will not be published.