Take 2: I’m having trouble referencing a particular XML element. Here’s hoping the list will help me stop banging my head against the wall. The wall doesn’t look good in red and some stains don’t come out so easily ….
I’m having two issues with my XML file (snippet of the XML file as generated by the R25 webservice included below). 1) the file I see when I download the file and save it as a text file is not the same thing as what I see when I reference the webservice in Firefox (which gives me that handy XML view). 2) and the real issue, is that I need to determine if, for each event, the custom attribute name “Audience: Alumni/Friends” exists, and if so, if the value is set to “Yes”. There are actually 6 custom attributes that are sometimes there, sometimes not (Audience: Athletics, Audience: Current Students, etc). To reference the event_name, I would use the following code: <CFSET tempTitle = XmlParse(mydoc.events.event[i].event_name)> <CFSET tempTitle = HTMLSafe(tempTitle.XmlRoot.xmlText)> That works. To reference the custom attribute that is sometimes there, sometimes not, I use the following code: <cfset customSize = findOccurrences(XmlParse(mydoc.events.event[i]),"Custom_Attribute")/2> <cfloop from="1" to="#customSize#" index="k"> <!--- loop over the number of custom attribute fields to find all the audiences ---> <cfset aVal = mydoc.events.event[i].custom_attribute[k].attribute_value> <CFSET thisInfo = XmlParse(aVal)> <CFSET Node_Root = thisInfo.XmlRoot> <cfif Node_Root.xmltext is "Yes"> <cfset xmlAudience = XmlParse(mydoc.events.event[i].custom_attribute[k].attribute_name)> <cfset category = trim(RemoveChars(xmlAudience.XmlRoot.xmltext,1,10))> <cfif category is "Put On Web"> <cfset xmlPutCal = XmlParse(mydoc.events.event[i].custom_attribute[k].attribute_value)> <CFSET xmlPutCal = HTMLSafe(xmlPutCal.XmlRoot.xmlText)> <br />xmlPutCal:#xmlPutCal#/<br /> <cfelseif category is "Faculty/Staff"> <cfset myTempCatList = listAppend(myTempCatList,"r25_fas")> <cfelseif category is "Parents/Family"> <cfset myTempCatList = listAppend(myTempCatList,"r25_pf")> <cfelseif category is "Alumni/Friends"> <cfset myTempCatList = listAppend(myTempCatList,"r25_af")> <cfelseif category is "Current Students"> <cfset myTempCatList = listAppend(myTempCatList,"r25_cs")> <cfelseif category is "Athletics"> <cfset myTempCatList = listAppend(myTempCatList,"r25_ath")> <cfelse> <cfset myTempCatList = listAppend(myTempCatList,"r25_tbc")> </cfif> </cfif> </cfloop> The above code USED to work. Now, however, it chokes at the findOccurrences and says custom_attribute doesn’t exist. I know the provider of the web service changed the query. However, when I pull the file via FireFox, the info is there. Any help would be welcome! (Anyone out there on 4:30 on a Friday?) Here is a snippet of an XML file as generated by R25 web service (as viewed in Firefox): <r25:events pubdate="2009-02-13T15:55:15-05:00"> <r25:event id="CBJDMjc1NTc4" crc="00000022" status="est"> <r25:event_name>5K Run</r25:event_name> <r25:start_date>2009-04-20</r25:start_date> <r25:end_date>2009-04-20</r25:end_date> <r25:event_locator>2008-AAPRRE</r25:event_locator> <r25:last_mod_dt>2008-11-10T13:46:59-05:00</r25:last_mod_dt> <r25:profile id="CCJDMzk4MDMxCBJDMjc1NTc4" crc="00000022" status="est"> <r25:profile_id xl:href="ev_profile.xml?profile_id=398031">398031</r25:profile_id> <r25:profile_description>From 05:30 PM to 07:00 PM on Mon Apr/20/2009.</r25:profile_description> <r25:init_start_dt>2009-04-20T17:30:00-05:00</r25:init_start_dt> <r25:init_end_dt>2009-04-20T19:00:00-05:00</r25:init_end_dt> <r25:reservation xl:href="reservation.xml?rsrv_id=2621824" id="CRJDMjYyMTgyNA==" crc="00000022" status="est"> <r25:reservation_id>2621824</r25:reservation_id> <r25:reservation_start_dt>2009-04-20T17:30:00-05:00</r25:reservation_start_dt> <r25:reservation_end_dt>2009-04-20T19:00:00-05:00</r25:reservation_end_dt> <r25:event_start_dt>2009-04-20T17:30:00-05:00</r25:event_start_dt> <r25:event_end_dt>2009-04-20T19:00:00-05:00</r25:event_end_dt> <r25:pre_event_dt>2009-04-20T17:30:00-05:00</r25:pre_event_dt> <r25:post_event_dt>2009-04-20T19:00:00-05:00</r25:post_event_dt> <r25:rsrv_comment_id/> <r25:rsrv_comments/> <r25:space_reservation id="BiJDMTcxMAkSQzI2MjE4MjQ=" crc="00000021" status="est"> <r25:space_id>1710</r25:space_id> <r25:space id="BhJDMTcxMA==" crc="00000023" status="est"> <r25:space_name>OXFORD CAMPUS</r25:space_name> <r25:formal_name>Oxford Campus</r25:formal_name> <r25:max_capacity>1000</r25:max_capacity> <r25:partition_name>Oxford Campus</r25:partition_name> </r25:space> </r25:space_reservation> </r25:reservation> </r25:profile> <r25:custom_attribute id="CBJDMjc1NTc4BSJDMTEy" crc="00000021" status="new"> <r25:attribute_id>112</r25:attribute_id> <r25:attribute_name>Audience: Alumni/Friends</r25:attribute_name> <r25:attribute_type>B</r25:attribute_type> <r25:attribute_type_name>Boolean</r25:attribute_type_name> <r25:attribute_value>Yes</r25:attribute_value> </r25:custom_attribute> <r25:custom_attribute id="CBJDMjc1NTc4BSJDMTEz" crc="00000021" status="new"> <r25:attribute_id>113</r25:attribute_id> <r25:attribute_name>Audience: Athletics</r25:attribute_name> <r25:attribute_type>B</r25:attribute_type> <r25:attribute_type_name>Boolean</r25:attribute_type_name> <r25:attribute_value>Yes</r25:attribute_value> </r25:custom_attribute> <r25:custom_attribute id="CBJDMjc1NTc4BSJDMTE0" crc="00000021" status="new"> <r25:attribute_id>114</r25:attribute_id> <r25:attribute_name>Audience: Current Students</r25:attribute_name> <r25:attribute_type>B</r25:attribute_type> <r25:attribute_type_name>Boolean</r25:attribute_type_name> <r25:attribute_value>Yes</r25:attribute_value> </r25:custom_attribute> This e-mail message (including any attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including any attachments) is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including attachments). N�����r��y����b�X��f�j���鮇���m����q����