RE: XPath help
Also remember that you can have an entire path, not just one element, searched with the name() function: "/*[name()='PostalCodeNumber']/*[name=()'ChildElem1']" I may not have the exact syntax correct, but you should get the gist of it. M!ke -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 11, 2006 2:02 PM To: CF-Talk Subject: RE: XPath help I have had problems with name spaces in Xpath... Someone gave me this little gem which searches on the tag name: XmlSearch( GeoCodeXML, "//*[name()='PostalCodeNumber']" ) This will search for any tag anywhere with name PostalCodeNumber. Not sure if that will work or cause problems as it might return more than one node?? Not that great with Xpath. Ben Nadel www.bennadel.com ~| 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/cf_lists/message.cfm/forumid:4/messageid:246164 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: XPath help
I think it is just a query issue. As Rob said, seeing the XML would be great. On 7/11/06, Howard Owens <[EMAIL PROTECTED]> wrote: > > Hey, that returns something useful. An array. Thanks. > > Now to figure out how to extract the one piece of info I want. > > H. > > > -Original Message- > From: Ben Nadel [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 11, 2006 12:02 PM > To: CF-Talk > Subject: RE: XPath help > > I have had problems with name spaces in Xpath... Someone gave me this > little > gem which searches on the tag name: > > XmlSearch( GeoCodeXML, "//*[name()='PostalCodeNumber']" ) > > This will search for any tag anywhere with name PostalCodeNumber. Not sure > if that will work or cause problems as it might return more than one > node?? > Not that great with Xpath. > > > Ben Nadel > www.bennadel.com > > > > > > ~| 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/cf_lists/message.cfm/forumid:4/messageid:246163 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: XPath help
Hey, that returns something useful. An array. Thanks. Now to figure out how to extract the one piece of info I want. H. -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 11, 2006 12:02 PM To: CF-Talk Subject: RE: XPath help I have had problems with name spaces in Xpath... Someone gave me this little gem which searches on the tag name: XmlSearch( GeoCodeXML, "//*[name()='PostalCodeNumber']" ) This will search for any tag anywhere with name PostalCodeNumber. Not sure if that will work or cause problems as it might return more than one node?? Not that great with Xpath. Ben Nadel www.bennadel.com ~| 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/cf_lists/message.cfm/forumid:4/messageid:246161 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: XPath help
I have had problems with name spaces in Xpath... Someone gave me this little gem which searches on the tag name: XmlSearch( GeoCodeXML, "//*[name()='PostalCodeNumber']" ) This will search for any tag anywhere with name PostalCodeNumber. Not sure if that will work or cause problems as it might return more than one node?? Not that great with Xpath. ... Ben Nadel www.bennadel.com -Original Message- From: Howard Owens [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 11, 2006 9:45 PM To: CF-Talk Subject: XPath help Anybody else have any clue why my XMLSearch(GeoCodeXML,"//PostalCodeNumber") might be returning an empty string? -Original Message- From: James Holmes [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 11, 2006 12:40 AM To: CF-Talk Subject: Re: There's got to be an easier way to parse this structure That's strange, because when I use and CFDUMP the result, I get an array of length 1, when using it on the XML sample at http://www.google.com/apis/maps/documentation/ On 7/11/06, Howard Owens <[EMAIL PROTECTED]> wrote: > Yes, I started noodling through that as you were sending this ... > > It seems like one of the following should return something other than > an empty array ... > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/XmlText/*"); > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/XmlText"); getNode > = XMLSearch(GeoCodeXML, "//PostalCodeNumber/*"); getNode = > XMLSearch(GeoCodeXML, "//PostalCodeNumber"); > > The only thing that hasn't returned an empty array so far is: > > getNode = XMLSearch(GeoCodeXML, "//*"); ~| 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/cf_lists/message.cfm/forumid:4/messageid:246157 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: XPath help
I don't know whether you've posted your XML, but if you did, I'm not seeing it. Maybe others aren't as well? Might be worth posting again... On 7/11/06, Howard Owens <[EMAIL PROTECTED]> wrote: > Anybody else have any clue why my XMLSearch(GeoCodeXML,"//PostalCodeNumber") > might be returning an empty string? > > -Original Message- > From: James Holmes [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 11, 2006 12:40 AM > To: CF-Talk > Subject: Re: There's got to be an easier way to parse this structure > > That's strange, because when I use > > > > and CFDUMP the result, I get an array of length 1, when using it on > the XML sample at > > http://www.google.com/apis/maps/documentation/ > > On 7/11/06, Howard Owens <[EMAIL PROTECTED]> wrote: > > Yes, I started noodling through that as you were sending this ... > > > > It seems like one of the following should return something other than an > > empty array ... > > > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/XmlText/*"); > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/XmlText"); > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/*"); > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber"); > > > > The only thing that hasn't returned an empty array so far is: > > > > getNode = XMLSearch(GeoCodeXML, "//*"); > > > > > ~| 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/cf_lists/message.cfm/forumid:4/messageid:246156 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: XPath help
Because the node is several elements deep, and not always in a consistent location. FWIW correction: below I meant "empty array." H. -Original Message- From: John C. Bland II [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 11, 2006 11:48 AM To: CF-Talk Subject: Re: XPath help Why do you have // vs /? On 7/11/06, Howard Owens <[EMAIL PROTECTED]> wrote: > > Anybody else have any clue why my > XMLSearch(GeoCodeXML,"//PostalCodeNumber") > might be returning an empty string? > > -Original Message- > From: James Holmes [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 11, 2006 12:40 AM > To: CF-Talk > Subject: Re: There's got to be an easier way to parse this structure > > That's strange, because when I use > > > > and CFDUMP the result, I get an array of length 1, when using it on > the XML sample at > > http://www.google.com/apis/maps/documentation/ > > On 7/11/06, Howard Owens <[EMAIL PROTECTED]> wrote: > > Yes, I started noodling through that as you were sending this ... > > > > It seems like one of the following should return something other than an > > empty array ... > > > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/XmlText/*"); > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/XmlText"); > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/*"); > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber"); > > > > The only thing that hasn't returned an empty array so far is: > > > > getNode = XMLSearch(GeoCodeXML, "//*"); > > > > > ~| 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/cf_lists/message.cfm/forumid:4/messageid:246155 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: XPath help
Why do you have // vs /? On 7/11/06, Howard Owens <[EMAIL PROTECTED]> wrote: > > Anybody else have any clue why my > XMLSearch(GeoCodeXML,"//PostalCodeNumber") > might be returning an empty string? > > -Original Message- > From: James Holmes [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 11, 2006 12:40 AM > To: CF-Talk > Subject: Re: There's got to be an easier way to parse this structure > > That's strange, because when I use > > > > and CFDUMP the result, I get an array of length 1, when using it on > the XML sample at > > http://www.google.com/apis/maps/documentation/ > > On 7/11/06, Howard Owens <[EMAIL PROTECTED]> wrote: > > Yes, I started noodling through that as you were sending this ... > > > > It seems like one of the following should return something other than an > > empty array ... > > > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/XmlText/*"); > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/XmlText"); > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber/*"); > > getNode = XMLSearch(GeoCodeXML, "//PostalCodeNumber"); > > > > The only thing that hasn't returned an empty array so far is: > > > > getNode = XMLSearch(GeoCodeXML, "//*"); > > > > > ~| 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/cf_lists/message.cfm/forumid:4/messageid:246153 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Xpath Help
Yeah, XPath is very cool, from what I have seen. I just started playing with XPath yesterday while considering rebuilding one of my existing apps. I don't know if this is the main reason, but I love the ability to "break down" the XML into smaller chunks that are more-managable. I have not run into the situation, but I would guess XPath would come in handy when needing to pull, in a single step, similar child elements from different parents. Keep up the good fight! M!ke -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 5:23 PM To: CF-Talk Subject: RE: Xpath Help Freakin' sweeet! Thanks Mike. This Xpath stuff looks pretty cool. I need to get learning this stuff. Especially when we move SQL 2005 in house. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240865 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Xpath Help
Freakin' sweeet! Thanks Mike. This Xpath stuff looks pretty cool. I need to get learning this stuff. Especially when we move SQL 2005 in house. ... Ben Nadel www.bennadel.com -Original Message- From: Dawson, Michael [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 6:16 PM To: CF-Talk Subject: RE: Xpath Help Glad to help! Since you say you know the format, I don't see any reasons why you should not do this. It certainly cuts down on the amount of digging you would have to do if you stopped the xmlSearch() a level above this element. This works just peachy: #results[1].XmlText# M!ke -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 4:54 PM To: CF-Talk Subject: RE: Xpath Help Mike, You rock! I would like to modify it to be: //*[name()='searchFor'] Since in only care about the searchFor node and not in it's relations to other elements; I know what the xml data is going to look like and am not worries about finding the wrong element. Any red flags about my way considering the small amount of data? . Ben Nadel www.bennadel.com -Original Message- From: Dawson, Michael [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 5:27 PM To: CF-Talk Subject: RE: Xpath Help Ahhh. This is what I was originally going for... xmlSearch(xmlPacket, "/soap:Envelope/soap:Body/*[name()='doDirectorySearch']/child::*") This search will return all child elements, of doDirectorySearch, with each element as an array item. The problem, with your xml, is that you have namespaces for "Envelope" and "Body", but no namespace for "doDirectorySearch". So, you have to search on a "name()" that is "doDirectorySearch" within your xml packet. M!ke ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240850 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Xpath Help
Glad to help! Since you say you know the format, I don't see any reasons why you should not do this. It certainly cuts down on the amount of digging you would have to do if you stopped the xmlSearch() a level above this element. This works just peachy: #results[1].XmlText# M!ke -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 4:54 PM To: CF-Talk Subject: RE: Xpath Help Mike, You rock! I would like to modify it to be: //*[name()='searchFor'] Since in only care about the searchFor node and not in it's relations to other elements; I know what the xml data is going to look like and am not worries about finding the wrong element. Any red flags about my way considering the small amount of data? Ben Nadel www.bennadel.com -Original Message- From: Dawson, Michael [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 5:27 PM To: CF-Talk Subject: RE: Xpath Help Ahhh. This is what I was originally going for... xmlSearch(xmlPacket, "/soap:Envelope/soap:Body/*[name()='doDirectorySearch']/child::*") This search will return all child elements, of doDirectorySearch, with each element as an array item. The problem, with your xml, is that you have namespaces for "Envelope" and "Body", but no namespace for "doDirectorySearch". So, you have to search on a "name()" that is "doDirectorySearch" within your xml packet. M!ke ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240849 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Xpath Help
Mike, You rock! I would like to modify it to be: //*[name()='searchFor'] Since in only care about the searchFor node and not in it's relations to other elements; I know what the xml data is going to look like and am not worries about finding the wrong element. Any red flags about my way considering the small amount of data? ... Ben Nadel www.bennadel.com -Original Message- From: Dawson, Michael [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 5:27 PM To: CF-Talk Subject: RE: Xpath Help Ahhh. This is what I was originally going for... xmlSearch(xmlPacket, "/soap:Envelope/soap:Body/*[name()='doDirectorySearch']/child::*") This search will return all child elements, of doDirectorySearch, with each element as an array item. The problem, with your xml, is that you have namespaces for "Envelope" and "Body", but no namespace for "doDirectorySearch". So, you have to search on a "name()" that is "doDirectorySearch" within your xml packet. M!ke ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240845 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Xpath Help
Ahhh. This is what I was originally going for... xmlSearch(xmlPacket, "/soap:Envelope/soap:Body/*[name()='doDirectorySearch']/child::*") This search will return all child elements, of doDirectorySearch, with each element as an array item. The problem, with your xml, is that you have namespaces for "Envelope" and "Body", but no namespace for "doDirectorySearch". So, you have to search on a "name()" that is "doDirectorySearch" within your xml packet. M!ke -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 4:00 PM To: CF-Talk Subject: Xpath Help Having some XmlSearch problems, need help, totally stuck, For some reason, the "results" object is not returning any results on "//doDirectorySearch". But, from the xml being saved below, it looks like it should totally work. I also tried "//[EMAIL PROTECTED]" thinking that it was an attribute issues, but no luck on that either. Thanks in advance! http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";> http://xstandard.com/2004/web-services";> en xxx snippets Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240843 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Xpath Help
This works, to a point. It will, at least, get your information into an array where you can access it a bit easier. You have to account for the namespaces, if any, as well as the elements, in your xml packet. I ran into this issue yesterday. Here is the source of my solution: http://www.talkingtree.com/blog/index.cfm/2005/11/18/XmlSearchNoNameName space M!ke -Original Message- From: Ben Nadel [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 4:00 PM To: CF-Talk Subject: Xpath Help Having some XmlSearch problems, need help, totally stuck, For some reason, the "results" object is not returning any results on "//doDirectorySearch". But, from the xml being saved below, it looks like it should totally work. I also tried "//[EMAIL PROTECTED]" thinking that it was an attribute issues, but no luck on that either. Thanks in advance! http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";> http://xstandard.com/2004/web-services";> en xxx snippets Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240842 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: XPath Help
At 07:04 AM 5/21/2004, you wrote: >Hi, I'm trying to get some XPath to work with respect to a navigation tree. > > > > > > > > > > > > > > > > > > > > >I can use Xpath to return all the child nodes within a node using >//[EMAIL PROTECTED]"3"] Couple of things here, Tony. 1) You can "chain" xpaths together. 2) Learn all of the Xpaths Axes (sp?)! In this case, you could grab the objectID of the node element with an objectID of 2134 like this: //[EMAIL PROTECTED]/parent::node Notice the reference to the exact node, and then a reference to the "parent" axis, asking for a "node" element. Hope this helps. -- Alex Sherwood PHS Collection Agency THE COLLECTORS P: 813-283-4579 F: 301.664.6834 W: www.phs-net.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: XPath Help
I shot that off to fast here is a more focused link. the site is a little confusing. http://www.zvon.org/xxl/XPathTutorial/Output/example1.html On May 21, 2004, at 7:56 AM, Ian Sheridan wrote: > I found this site to be an excellent eye opener for xPath. > > http://www.zvon.org/xxl/XPathTutorial/General/examples.html Ian - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ian Sheridan [EMAIL PROTECTED] http://www.savagevines.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: XPath Help
I found this site to be an excellent eye opener for xPath. http://www.zvon.org/xxl/XPathTutorial/General/examples.html Ian - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ian Sheridan [EMAIL PROTECTED] http://www.savagevines.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]