At 11:19 AM 3/12/2003 -0600, you wrote: >That's sort of what I was afraid of. If it's legal XPath syntax, then why >doesn't the XmlSearch function support it? Is it a weakness in MX, or is >this a deliberate omission? And does anybody know if MM has plans to >support this in the future?
Well, i think it has more to do with how MACR wanted to implement the XMLSearch feature. The W3C spec doesn't specifiy how the parser should return data, it just specifies that the XPATH should locate the element/attribute in the document - no matter what. MACR just decided that they wanted to return an array instead of say, a string variable or a number. This makes sense when, in many cases, you're not sure how much data is going to come back. The function is standardized to return the same data type on each call: an array. Look at this Xpath, for example: '//Address'. If you XMLSearch()'ed on this path and the parser found 4 valid elements, how would it be returned to you? In an array or some other "collection" like data type (struct, hash table, etc.). BUT, when you are using XMLSearch() to grab one element's attribute, how can the function just return you a string, and not an array? You would have to write code after each function call to decided how to process the return data. Did I get back an array to loop over or a string? MACR just went with the array because it make the most sense - regardless of what the parser finds. Even if you search for one element, you grab it at index[1], and use XMLAttributes to extract the string or numeric value. It would be nice, however, to have an XMLExtractAttribute() function, that simply returns the first attribute (in the form of a string return type) value found for the supplied XPATH. >-----Original Message----- >From: Jochem van Dieten [mailto:[EMAIL PROTECTED] >Sent: Wednesday, March 12, 2003 11:24 AM >To: CF-Talk >Subject: Re: XPath in CFMX > > >Mueller, Ben wrote: > > Yes, that is exactly what I want. It would appear (at least from > > Microsoft's website) that this is legal Xpath syntax. A previous poster > > suggested that this may have been an extension MS made that falls outside > > the w3c spec. At this point, I'd be happy with confirmation that a call > > like "Books/Book/@type" is just illegal according to the w3c spec. > >I think it is legal syntax. http://www.w3.org/TR/xpath section 2.5 > >Jochem > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4