Thanks for the tip, Justin!  I'll give it a try!

Rick

-----Original Message-----
From: Justin Scott [mailto:leviat...@darktech.org] 
Sent: Friday, December 30, 2011 7:51 PM
To: cf-talk
Subject: Re: XML! Aaargh! How do I do this?


> Okay... I've worked this every way I can think
> of and, I admit it, I just don't get it.

Hi Rick, replace your inner-most loop with the following.  It should
get you going in the right direction.  It looks like there is another
layer of sub-categories which needs to be accounted for:

<!--- Loop over the sub-categories --->
<cfloop from='1' to='#arrayLen(xmlProductContent.products.SubCategory)#'
                     index='subCategoryCount'>

  <!--- Localize our current sub-category --->
  <cfset thisSubCategory =
xmlProductContent.products.SubCategory[subCategoryCount] />
  <h2>#thisSubCategory.SubCategoryName.xmlText#</h2>

  <!--- Loop over the products in this sub-category --->
  <cfloop from="1" to="#arrayLen(thisSubCategory.Product)#"
index="productCount">
    <!--- Localize our current product for easier access --->
    <cfset thisProduct = thisSubCategory.Product[productCount] />
    <!---<cfdump var="#thisProduct#" />--->
    <p>
      ID: #thisProduct.xmlAttributes.ID#<br />
      Model Name: #thisProduct.ModelName.xmlText#<br />
      Image: <img src="#thisProduct.SmallImage.xmlText#" />
    </p>
  </cfloop> <!--- Products --->

</cfloop>  <!--- Sub-Categories --->


-Justin Scott



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349276
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to