Hello,

I am having a problem that I desperately need help with.  I am working with
consuming XML WebServices using CFMX, here is my problem.

I have an XML child called EVENT that also has many children. However, each
EVENT record occurence does not ALWAYS have the same children. Sometimes it
has children called HEADERLINKS and sometimes it is does not. Of course, if
it does have the child called HEADERLINKS, then it too has several children.
I want to loop through and IF the HEADERLINKS child exists THEN output every
occurence of the HEADERLINKS and its children.

I get the most recent record (which is what I want) but it stops because it
knows that the second record doesn't contain the HEADERLINKS child.  I need
it to continue on and look at all the other records and OUTPUT those other
records that do have the HEADERLINKS child and it's respective children.

My code is below:

<CFSETxmlobj = xmlParse(cfhttp.fileContent, false)>
<body>
<CFSET EVENTS = xmlobj.irxml>
<CFSET EVENTRoot = xmlobj.irxml.EVENTS>
<CFSET EVENTList = EVENTRoot.EVENT>
<CFSET EVENTListW = EVENTList.EventTitle>
<CFSET EVENTAll = ArrayLen(EVENTRoot.xmlChildren)>
<CFOUTPUT>
<div align="center">
    <font size="2" face="Verdana, Arial, Helvetica, sans-serif">Number of
EVENTS:</font>
 <font color="##FF0000"><strong>#EVENTAll#</strong></font></div>
</CFOUTPUT>

<CFLOOP from="#ArrayLen(EVENTRoot.xmlChildren)#" to="1" index="i" step="-1">
<br>

<CFIF isDefined ("EVENTList.HeaderLinks.HeaderLink")>

<CFOUTPUT>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><div align="center"><a
href="#EVENTList[i].HeaderLinks.HeaderLink.Webcasts.Webcast.Streams.Stream.U
RL.xmlText#">
              <img
src="#EVENTList[i].HeaderLinks.HeaderLink.ImageURL.xmlText#"
border="0"></a></div></td>
        <td><div align="center"><font size="2" face="Verdana, Arial,
Helvetica,
sans-serif">#EVENTList[i].HeaderLinks.HeaderLink.Title.xmlText#<br>
            </font></div></td>
      </tr>
      <tr bgcolor="##000099">
        <td></td>
        <td height="1"></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
</CFOUTPUT>
</CFIF>
</CFLOOP>

Thank you in advance for your help!

Shawn Contreras


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to