I am nooo xml expert, so this may be waay off base, but could you just param
the xml attributes for each loop:
<cfloop ....>
<cfparam
name="xmlData.XmlRoot.XmlChildren[ #i# ].XmlAttributes.KEY"
type="string"
default="VALUE"
/>
<cfdump
var="#xmlData.XmlRoot.XmlChildren[ i ].XmlAttributes.KEY#"
/>
</cfloop>
.......................
Ben Nadel
www.bennadel.com
-----Original Message-----
From: Ray Champagne [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 22, 2006 8:27 AM
To: CF-Talk
Subject: XML looping problems
I've been given an XML document that needs to be parsed into a query, and
I'm having some issues I need help with.
XML sample:
<officelocations>
<dir_office_atm_locations id="1" name="Headquarters" address="Ten Post
Office Square" office="1" atm="1" link="http://www.mapquest.com" sort="1"
phone="(123) 123-1919" fax="(123)123-4550" city="Boston"
state="Massachusetts" zip="02109"/>
<dir_office_atm_locations id="2" address="Boylston Street" office="1"
atm="1" link="http://www.mapquest.com" sort="2" phone="(123)123-4500"
fax="(123)123-4290" city="Boston" state="Massachusetts" zip="02116"/>
</officelocations>
Notice that the second node has "name" attribute. That's what is giving me
fits when looping over the XML. Seems like no matter what I try, if that
"name" attribute isn't defined, the loop will throw an error. I have no
control over the XML creation, or I'd just make name="" if there is no
location and this would be done with.
I'm not really an expert when it comes to XML, so any help with this is
appreciated. Is this considered to be an invalid XML document because of
the inconsistency?
Ray
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250585
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4