Re: XML! Aaargh! How do I do this?

2012-01-01 Thread James Holmes

BTW, the issue with the existing code is this:

 xmllennox-products

CF thinks you are trying to do maths on xmllennox and products by
subtracting one from the other.


--
Shu Ha Ri: Agile and .NET blog
http://www.bifrost.com.au/


On 2 January 2012 10:10, James Holmes  wrote:

> xmllennox-products


~|
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:349289
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: XML! Aaargh! How do I do this?

2012-01-01 Thread James Holmes

Try searching directly for the modelName:



Dump that result to see how to get the name.

--
Shu Ha Ri: Agile and .NET blog
http://www.bifrost.com.au/


On 2 January 2012 09:18, Rick Faircloth  wrote:

> At this point, all I'm really after is the "modelName/text()"


~|
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:349288
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: XML! Aaargh! How do I do this?

2012-01-01 Thread Rick Faircloth

Sorry, guys... complete forgot to post the CF code!
At this point, all I'm really after is the "modelName/text()"
(See below)...

I just haven't gotten to the point where I understand how
to parse through the node and info, therein. If you need more
code, I'll go to pastbin.

Thanks for the feedback!

Rick







Lennox XML Search Test





xmlSearch()








XPath
Result

























#xp#




#xmlGetNodeType(arrResult[index])#:



#arrResult[index].xmlText#

#arrResult[index]#


















-Original Message-
From: Eric Roberts [mailto:ow...@threeravensconsulting.com] 
Sent: Sunday, January 01, 2012 6:32 PM
To: cf-talk
Subject: RE: XML! Aaargh! How do I do this?


What are the values of xmllennox in the xml page (or what is it supposed to
be derived from)? And what is the search trying to search for?

-Original Message-
From: Rick Faircloth [mailto:r...@whitestonemedia.com] 
Sent: Sunday, January 01, 2012 3:53 PM
To: cf-talk
Subject: RE: XML! Aaargh! How do I do this?


Hopefully, the error of my ways will be obvious to thos of you who work with
xml a lot, but...HELP!!!

Given this demo xml:



Air Conditioners

Air Conditioners



XC21
XC21 Air Conditioner
The most quiet and efficient central air
conditioner you can buy

up to 20.5
69


http://www.lennox.com/res/photos/44383_small.jpg
$$$


(product repeats ...)

What's wrong with this code?
I constantly get the error:
"The value coldfusion.xml.XmlNodeList cannot be converted to a number."
The error occurred on line 44, which reads:



Suggests, good tutorials?  The one I've been following isn't quite complete
enough the complexity of my xml sheet.

Rick









Lennox XML Search Test





xmlSearch()








XPath
Result

























#xp#




#xmlGetNodeType(arrResult[index])#:



#arrResult[index].xmlText#

#arrResult[index]#


















-Original Message-
From: James Holmes [mailto:james.hol...@gmail.com]
Sent: Friday, December 30, 2011 8:14 PM
To: cf-talk
Subject: Re: XML! Aaargh! How do I do this?


If you are just after products, you can dramatically simplify the code by
using xmlsearch() to get them with xpath instead of manually looping
multiple levels down.

--
Shu Ha Ri: Agil

RE: XML! Aaargh! How do I do this?

2012-01-01 Thread Eric Roberts

What are the values of xmllennox in the xml page (or what is it supposed to
be derived from)? And what is the search trying to search for?

-Original Message-
From: Rick Faircloth [mailto:r...@whitestonemedia.com] 
Sent: Sunday, January 01, 2012 3:53 PM
To: cf-talk
Subject: RE: XML! Aaargh! How do I do this?


Hopefully, the error of my ways will be obvious to thos of you who work with
xml a lot, but...HELP!!!

Given this demo xml:



Air Conditioners

Air Conditioners



XC21
XC21 Air Conditioner
The most quiet and efficient central air
conditioner you can buy

up to 20.5
69


http://www.lennox.com/res/photos/44383_small.jpg
$$$


(product repeats ...)

What's wrong with this code?
I constantly get the error:
"The value coldfusion.xml.XmlNodeList cannot be converted to a number."
The error occurred on line 44, which reads:



Suggests, good tutorials?  The one I've been following isn't quite complete
enough the complexity of my xml sheet.

Rick









Lennox XML Search Test





xmlSearch()








XPath
Result

























#xp#




#xmlGetNodeType(arrResult[index])#:



#arrResult[index].xmlText#

#arrResult[index]#


















-Original Message-
From: James Holmes [mailto:james.hol...@gmail.com]
Sent: Friday, December 30, 2011 8:14 PM
To: cf-talk
Subject: Re: XML! Aaargh! How do I do this?


If you are just after products, you can dramatically simplify the code by
using xmlsearch() to get them with xpath instead of manually looping
multiple levels down.

--
Shu Ha Ri: Agile and .NET blog
http://www.bifrost.com.au/


On 31 December 2011 08:50, Justin Scott  wrote:

>
> > 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:
>
> 
>  index='subCategoryCount'>
>
>  
>   xmlProductContent.products.SubCategory[subCategoryCount] />
>  #thisSubCategory.SubCategoryName.xmlText#
>
>  
>   index="productCount">
>
>
>
>
>  ID: #thisProduct.xmlAttributes.ID#
>  Model Name: #thisProduct.ModelName.xmlText#
>  Image: 
>
>   
>
>   
>
>
> -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:349286
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: XML! Aaargh! How do I do this?

2012-01-01 Thread Russ Michaels

Rick,

I generally find the easiest way to work through an XML doc is to create a
page that just converts it to an XMLDOC first using  or xmlparse()
 and them CFDUMP the result.
This makes it must easier to find the node references you need to loop
through or reference.
I also prefer to simplify my code by creating a new reference out deep
nested blocks, such as nodes I need to loop over, as this results in
shorter references, especially if they contains array counters, dynamic
evaluations etc to get at the correct element.

If your still struggling, then I would suggest posting the full code and
XML at pastebin.com so we can see it and test it.


--

Russ Michaels

www.bluethunderinternet.com  : Business hosting services & solutions
www.cfmldeveloper.com: ColdFusion developer community
www.michaels.me.uk   : my blog
www.cfsearch.com : ColdFusion search engine
**
*skype me* : russmichaels


~|
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:349285
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: XML! Aaargh! How do I do this?

2012-01-01 Thread Rick Faircloth

Hopefully, the error of my ways will be obvious to thos
of you who work with xml a lot, but...HELP!!!

Given this demo xml:



Air Conditioners

Air Conditioners



XC21
XC21 Air Conditioner
The most quiet and efficient central air
conditioner you can buy

up to 20.5
69


http://www.lennox.com/res/photos/44383_small.jpg
$$$


(product repeats ...)

What's wrong with this code?
I constantly get the error:
"The value coldfusion.xml.XmlNodeList cannot be converted to a number."
The error occurred on line 44, which reads:



Suggests, good tutorials?  The one I've been following
isn't quite complete enough the complexity of my xml sheet.

Rick









Lennox XML Search Test





xmlSearch()








XPath
Result

























#xp#




#xmlGetNodeType(arrResult[index])#:



#arrResult[index].xmlText#

#arrResult[index]#


















-Original Message-
From: James Holmes [mailto:james.hol...@gmail.com] 
Sent: Friday, December 30, 2011 8:14 PM
To: cf-talk
Subject: Re: XML! Aaargh! How do I do this?


If you are just after products, you can dramatically simplify the code by
using xmlsearch() to get them with xpath instead of manually looping
multiple levels down.

--
Shu Ha Ri: Agile and .NET blog
http://www.bifrost.com.au/


On 31 December 2011 08:50, Justin Scott  wrote:

>
> > 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:
>
> 
>  index='subCategoryCount'>
>
>  
>   xmlProductContent.products.SubCategory[subCategoryCount] />
>  #thisSubCategory.SubCategoryName.xmlText#
>
>  
>   index="productCount">
>
>
>
>
>  ID: #thisProduct.xmlAttributes.ID#
>  Model Name: #thisProduct.ModelName.xmlText#
>  Image: 
>
>   
>
>   
>
>
> -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:349284
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: XML! Aaargh! How do I do this?

2011-12-30 Thread Rick Faircloth

Thanks for the info, James!

I had actually been doing some more research on
CF and XML and was reading about xmlSearch.  I'll
give that try, too.

Rick

-Original Message-
From: James Holmes [mailto:james.hol...@gmail.com] 
Sent: Friday, December 30, 2011 8:14 PM
To: cf-talk
Subject: Re: XML! Aaargh! How do I do this?


If you are just after products, you can dramatically simplify the code by
using xmlsearch() to get them with xpath instead of manually looping
multiple levels down.

--
Shu Ha Ri: Agile and .NET blog
http://www.bifrost.com.au/


On 31 December 2011 08:50, Justin Scott  wrote:

>
> > 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:
>
> 
>  index='subCategoryCount'>
>
>  
>   xmlProductContent.products.SubCategory[subCategoryCount] />
>  #thisSubCategory.SubCategoryName.xmlText#
>
>  
>   index="productCount">
>
>
>
>
>  ID: #thisProduct.xmlAttributes.ID#
>  Model Name: #thisProduct.ModelName.xmlText#
>  Image: 
>
>   
>
>   
>
>
> -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:349277
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: XML! Aaargh! How do I do this?

2011-12-30 Thread Rick Faircloth

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:




  
  
  #thisSubCategory.SubCategoryName.xmlText#

  
  




  ID: #thisProduct.xmlAttributes.ID#
  Model Name: #thisProduct.ModelName.xmlText#
  Image: 

   

  


-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


Re: XML! Aaargh! How do I do this?

2011-12-30 Thread James Holmes

If you are just after products, you can dramatically simplify the code by
using xmlsearch() to get them with xpath instead of manually looping
multiple levels down.

--
Shu Ha Ri: Agile and .NET blog
http://www.bifrost.com.au/


On 31 December 2011 08:50, Justin Scott  wrote:

>
> > 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:
>
> 
>  index='subCategoryCount'>
>
>  
>   xmlProductContent.products.SubCategory[subCategoryCount] />
>  #thisSubCategory.SubCategoryName.xmlText#
>
>  
>   index="productCount">
>
>
>
>
>  ID: #thisProduct.xmlAttributes.ID#
>  Model Name: #thisProduct.ModelName.xmlText#
>  Image: 
>
>   
>
>   
>
>
> -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:349275
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: XML! Aaargh! How do I do this?

2011-12-30 Thread Justin Scott

> 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:




  
  
  #thisSubCategory.SubCategoryName.xmlText#

  
  




  ID: #thisProduct.xmlAttributes.ID#
  Model Name: #thisProduct.ModelName.xmlText#
  Image: 

   

  


-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:349274
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


XML! Aaargh! How do I do this?

2011-12-30 Thread Rick Faircloth

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

Where am I going wrong?

Ultimately, I want to get the categories of products
and list the products of each category.

I can get the categories, along with the descriptions,
and images, but just can't figure out how to loop
through the products.

Clues for the cluesless?

Rick

PS - you can see the cfdumps in the code to show
the actual XML I'm trying to work with.  I've seen
examples of the XML data put into a database and then
worked with from there. Would that be preferable?





 URLToPull = 'http://lennox.com/api/v1/z7RRSHM/categories/';










 XMLContent = trim(cfhttp.fileContent);
 XMLContent = XMLParse(XMLContent);










  #XMLContent.Categories.Category[idx].CategoryName.xmlText#
  #XMLContent.Categories.Category[idx].shortDescription.xmlText#
  
  

  

   URLProducts =
'http://lennox.com/api/v1/z7RRSHM/category/#idx#';

  

   
  

  

   xmlProductContent = trim(cfhttp.fileContent);
   xmlProductContent = xmlParse(xmlProductContent);

  

  

  

 
#xmlProductContent.products.subcategories[productCount].products.xmlChildren
.xmlText#

  






The last cfloop above is what I'm having trouble with...

Thanks for any help!

Rick



~|
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:349269
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm