tracker issue : CF-3377581

select a category, or use search below
(searches all categories and all time range)
Title:

XmlSearch No Longer Supports No-Name Namespace

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Mikel Goicoechea / Mikel Goicoechea (Mikel Goicoechea)

Created: 12/04/2012

Components: General Server

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final /

Priority/Frequency: Major / All users will encounter

Locale/System: English / Win 2008 Server R2 64 bit

Vote Count: 2

Problem Description:  XmlSearch() used to accept search paths such as this: "/:Something/:SomethingElse

Steps to Reproduce:  See code snippet in note

Actual Result: error

Expected Result: text from xml

Any Workarounds:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3377581

External Customer Info:
External Company:  
External Customer Name: basquewndr
External Customer Email:  
External Test Config: My Hardware and Environment details: IIS 7, Windows Server 2008, ColdFusion 10

Attachments:

Comments:

<cfxml variable="xmlObject"> <?xml version="1.0" encoding="UTF-8"?> <ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Name>fred</Name> </ListBucketResult> </cfxml> <cfset name = XmlSearch(xmlObject,"/ListBucketResult/Name")> <cfdump var="#name#"><!--- cf9: empty array, cf10: empty array ---> <cfset name = XmlSearch(xmlObject,"/:ListBucketResult/:Name")[1].XmlText> <cfoutput><br>[#name#]</cfoutput><!--- cf9: "fred", cf10: error - "Unable to process the result of the XMLSearch for Unexpected colon at start of token." ---> <!--- more info on the no-name namespace: http://www.talkingtree.com/blog/index.cfm/2005/11/18/XmlSearchNoNameNamespace --->
Comment by External U.
17035 | December 04, 2012 01:15:41 PM GMT
With ColdFusion 10, saxon library is being used for xml processing. So xpath query needs to be synatctically proper. And also the xml used in this context does not have details about namespace. If you could let us know for what actually you are looking for from this, it would be easier for us to analyse further.
Comment by Akhila K.
17036 | December 06, 2012 04:30:12 AM GMT
if what you say is right and the xml does not have a namespace, then this: <cfset name = XmlSearch(xmlObject,"/ListBucketResult/Name")> should result in an array with one member. instead of an array with zero members. but what happens is that there is a namespace. the no-name namespace. but there is no longer a way to reference it. it used to be possible to reference it with just a colon. you can read more about the no-name namespace here: http://www.talkingtree.com/blog/index.cfm/2005/11/18/XmlSearchNoNameNamespace
Comment by External U.
17037 | December 06, 2012 10:30:42 AM GMT
This pretty much breaks anything using XSearch to do xpath into xml using a non-prefixed default namespace (e.g. xmlns="<whatever>"), which is a very common thing. You can't control the xml coming back from 3rd parties, so when they use non-prefixed namespaces this leaves you in a jam to do a lot of new workarounds, especially if you were navigating several layers deep into the xml.
Vote by External U.
17042 | December 12, 2012 12:27:11 PM GMT
I have this same problem. "Unable to process the result of the XMLSearch for Unexpected colon at start of token". Please fix!
Vote by External U.
17043 | May 01, 2013 04:28:06 PM GMT
I hit this bug as well.
Comment by External U.
17038 | August 09, 2013 12:55:38 PM GMT
Akhila, I have no reason to doubt you, but could you please point me to the spec wherein it says empty namespaces are illegal? I'm guessing you have it there in front of you, and it'd just save me time trying to find it to verify what you say. Cheers. -- Adam
Comment by External U.
17039 | October 09, 2013 03:14:57 PM GMT
Regarding the issue that following code <cfset name = XmlSearch(xmlObject,"/ListBucketResult/Name")> will results in empty array, the fact is that since the namespace has been defined for ListBucketResult node /ListBucketResult will not match that. This can be addressed in two ways in XPath expression 1) Use /* as XmlSearch(xmlObject,"/*:ListBucketResult/*:Name") instead of providing unnamed namespace /:ListBucketResult which is invalid. 2) In case you want to match the node with exact namespace then try following expression where we compare namespace uri and local-name XmlSearch(xmlObject,"//*[namespace-uri() = 'http://s3.amazonaws.com/doc/2006-03-01/' and local-name() = 'Name']") (Comment added from ex-user id:sandeepp)
Comment by Adobe D.
17040 | November 24, 2014 05:51:36 AM GMT
I have just noticed it's over a year later, and no response from Akhila re my previous question.
Comment by External U.
17041 | December 05, 2014 03:56:39 AM GMT