Yeah, thanks Rick, good tip. You'll find that working with CF XML nodes is a lot like working with structs and arrays, so most of those array*() and struct*() built-in functions will work with your XML.
nathan strutz [www.dopefly.com] [hi.im/nathanstrutz] [about.me/nathanstrutz] On Thu, Jan 19, 2012 at 2:08 PM, Rick Faircloth <[email protected]>wrote: > > I'm working with XML for my first time and I ran > into an issue. > > This is one of the Categories, Products, Product Details > hierarchies. > > I've got everything figured out so far, but ran into a > product node which didn't contain what's called in the > document, a "OneLiner" child node. (Now, I was under the > impression that all XML nodes were supposed to be alike > in the nodes they contain, even if they don't contain content...) > > But, nope, sure enough this "product" node had a > Product Name node, a Product Manufacturer node, etc., > but no "OneLiner" node as did all the rest. > > I searched on the internet for "how to test for the > existence of an xml child node" and "coldfusion 9 test > for for existence of xml node", etc. > > Finally, I just tried this: > > <cfif structKeyExists(productsArray[index], 'OneLiner') > > > <p class="product_oneliner">#productsArray[index].OneLiner.xmlText#</p> > > </cfif> > > And what do you know... it worked! > > Just FYI, for anyone struggled with XML and CF. > > 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:349551 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

