I think you may want:

if(structKeyExists(AmazonXML.ItemLookupResponse.Items.Item.ItemAttributes, 
"Author"))

{
Book.Author 
=AmazonXML.ItemLookupResponse.Items.Item.ItemAttributes.Author.XmlText;
}

How about giving that a try...

-- Josh





----- Original Message ----- 
From: "Howard Owens" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Thursday, June 29, 2006 8:44 PM
Subject: RE: If the structure exists, otherwise ... consistency needed


> Here's my scratch page, where I'm doing my testing:
>
> http://www.howardowens.com/amazon.cfm
>
> For the current query, look at the "author" field in the CFDUMP (top) of 
> the
> entire XML, and the CFDUMP (bottom) of my "book" structure.  You'll see in
> the top dump, "author" is there, but in the parsed structure, it is not.
>
>
> Here is the relevant portion of the script:
>
>
> <cfscript>
> AmazonXML = XmlParse(cfhttp.filecontent);
> Book = StructNew();
>
>
>
> // check for author and set value if exists
> if(structKeyExists(AmazonXML.ItemLookupResponse.Items.Item,"ItemAttributes.A
> uthor")) {
> Book.Author =
> AmazonXML.ItemLookupResponse.Items.Item.ItemAttributes.Author.XmlText;
> }
>
> else {
> Book.Author = '';
> }
>
>
> </cfscript>
>
> Thanks.
>
> H.
>
>
> -----Original Message-----
> From: Ian Skinner [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 29, 2006 1:36 PM
> To: CF-Talk
> Subject: RE: If the structure exists, otherwise ... consistency needed
>
> Can you provide a small but complete example of a true and false condition
> of the xml you are working with?
>
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> ---------
> | 1 |   |
> ---------  Binary Soduko
> |   |   |
> ---------
>
> "C code. C code run. Run code run. Please!"
> - Cynthia Dunning
>
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message.
>
>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:245094
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to