[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Looping through and XML documetn with Coldfusion

Posted on 2010-09-12
9
Medium Priority
?
525 Views
Last Modified: 2013-11-18
I need to loop through and XML document with coldfusion. The link below opens a YouTube XML document. I want to loop through the accessControl under entry. I thought I could just use ArrayToList and this might work I just do not know how to format it or if this will not work please let me know what would.

ArrayToList(what do I put in here)

http://www.pigskinu.com/test.html

feed.entry.accessControl.XmlAttributes.permission
0
Comment
Question by:RickEpnet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 33657789
Do you have PHP available to you?
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 33657796
Can you provide the xml file either by upload to EE or poste the xml on the server like the test.html.
0
 
LVL 14

Author Comment

by:RickEpnet
ID: 33658565
Ray_Paseur
I do have PHP on this server but I am not going to use it for this.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 14

Author Comment

by:RickEpnet
ID: 33658582
Zvonko
Here is the XML file
youtube.xml
0
 
LVL 14

Author Comment

by:RickEpnet
ID: 33659347
Never mind I got is solved myself. If any one is interested this is how it is done.


<cfhttp url='http://gdata.youtube.com/feeds/api/users/#trim(getvdfrompl.ytchannel)#/uploads?q=FootBall&start-index=1&max-results=25&v=2' method='get'>

<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0"></cfhttp>     
<cfset objRSS = xmlParse(cfhttp.filecontent)>

<cfloop index="i" from="1" to="#ArrayLen(objRSS.feed.entry)#">
       	<cfset isembed = "N">
	<cfloop index="j" from="1" to="#ArrayLen(objRSS.feed.entry[i].accessControl)#">
            <cfif objRSS.feed.entry[i].accessControl[j].XmlAttributes.action is "embed">
        	<cfif  objRSS.feed.entry[i].accessControl[j].XmlAttributes.permission is "allowed">
               	     <cfset isembed = "Y">
                 </cfif>        	
            </cfif>
        </cfloop>
</cfloop>

Open in new window

0
 
LVL 4

Expert Comment

by:silvera21
ID: 33662706
Any XML file that is parsed in coldfusion can be referenced as a struct. So a collection loop will also work, and would probably be a bit more simple (don't have to check the length).

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Part_3_CFML_Ref_1.html 
0
 
LVL 14

Author Comment

by:RickEpnet
ID: 33663466
silvera21
I would like to see an example but the link only took me to a CFML Reference page.
0
 
LVL 4

Accepted Solution

by:
silvera21 earned 2000 total points
ID: 33663777
Sorry, here is the link (stupid frame!):

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_j-l_16.html#2393950

The collection would probably be objRSS.feed.entry

This isn't tested, so it may need some tweaking, but maybe...

<cfloop collection="#objRSS.feed.entry#" item="entry">
    <cfset isembed = "N">
    <cfloop collection="#entry.accesscontrol#" item="access">
          <cfif access.XmlAttributes.action is "embed" AND access.XmlAttributes.permission is "allowed">      
                          <cfset isembed = "Y">       
            </cfif>

    </cfloop>
</cfloop>
0
 
LVL 14

Author Comment

by:RickEpnet
ID: 33664078
I will give it a try.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question