As you said, xmlSearch doesn't support attributes as an endpoint so whatever
results you get from using an xpath that searches for an attribute is
totally useless, regardless if it is an empty string or empty array.  Really
it should throw an error.

Besides, for stuff like that you can just do

xmlDoc.addresses.address[1].xmlAttributes.city

Much faster than using xpath.  XPath is going to be slower than dot notation
so only use it when you really need it.

HTH,

Sam

----------------------------------------------
Blog:  http://www.rewindlife.com
Chart: http://www.blinex.com/products/charting
----------------------------------------------
-----Original Message-----
From: Alexander Sherwood [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 18, 2003 3:59 PM
To: CF-Talk
Subject: XMLSearch() woes

If you do the following:

XMLSearch(xmlDoc, '/addresses/address[1]/@city'),

you get back an array with one element that contains an empty string.
Wouldn't you expect it to either return and empty array (because it found
nothing), or an array with the value of the attribute? I know the docs
state that XMLSearch returns and XMLElement object, but in this case, it
most certainly does not!

Anyone have the same problem?!

----------------------------------
Alex Sherwood
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to