Re: XPATH
Tested on CF8, this will give you an array of the ProductionStatus column elements: //data[1]/data/data This works for your example but may need tweaking depending on the format of other results of course. Would like to see what it looks like with more than one result / column. Dom On 27 May 2010 04:31, Mark Mandel mark.man...@gmail.com wrote: Chad, There is a great discussion of exactly this issue here: http://www.bennadel.com/blog/494-Stripping-XML-Name-Spaces-And-Node-Prefixes-From-ColdFusion-XML-Data-To-Simplify-XPath-.htm Basically - xpath and namespaces are a pain in cf. Check the comments of the blog post, they offer a good number of good ideas. Mark On Thu, May 27, 2010 at 3:06 AM, Chad Gray cg...@careyweb.com wrote: Can someone help me figure out the XPATH of the node that contains DISK SENT? Thanks! Chad ?xml version=1.0 encoding=UTF-8? soapenv:Envelope xmlns:soapenv= http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; soapenv:Body ns1:jobStatusResponse soapenv:encodingStyle= http://schemas.xmlsoap.org/soap/encoding/; xmlns:ns1= http://DefaultNamespace; jobStatusReturn xsi:type=ns2:QueryBean xmlns:ns2= http://rpc.xml.coldfusion; columnList soapenc:arrayType=xsd:string[1] xsi:type=soapenc:Array xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; columnList xsi:type=xsd:stringPRODUCTIONSTATUS/columnList /columnList data soapenc:arrayType=xsd:anyType[][1] xsi:type=soapenc:Array xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; data soapenc:arrayType=xsd:anyType[1] xsi:type=soapenc:Array data xsi:type=soapenc:stringDISK SENT/data /data /data /jobStatusReturn /ns1:jobStatusResponse /soapenv:Body /soapenv:Envelop ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334033 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: XPATH
Thanks Dominic, that worked like a charm. I swear I tried that notation, but apparently I did not. I tried a multi-record query and if you want the first record you would just add [1] to the second data. //data[1]/data[1]/data If you dont you return all the records in the first data[1]. Thanks again for the help! Chad -Original Message- From: Dominic Watson [mailto:watson.domi...@googlemail.com] Sent: Thursday, May 27, 2010 4:33 AM To: cf-talk Subject: Re: XPATH Tested on CF8, this will give you an array of the ProductionStatus column elements: //data[1]/data/data This works for your example but may need tweaking depending on the format of other results of course. Would like to see what it looks like with more than one result / column. Dom On 27 May 2010 04:31, Mark Mandel mark.man...@gmail.com wrote: Chad, There is a great discussion of exactly this issue here: http://www.bennadel.com/blog/494-Stripping-XML-Name-Spaces-And-Node-Prefixes-From-ColdFusion-XML-Data-To-Simplify-XPath-.htm Basically - xpath and namespaces are a pain in cf. Check the comments of the blog post, they offer a good number of good ideas. Mark On Thu, May 27, 2010 at 3:06 AM, Chad Gray cg...@careyweb.com wrote: Can someone help me figure out the XPATH of the node that contains DISK SENT? Thanks! Chad ?xml version=1.0 encoding=UTF-8? soapenv:Envelope xmlns:soapenv= http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; soapenv:Body ns1:jobStatusResponse soapenv:encodingStyle= http://schemas.xmlsoap.org/soap/encoding/; xmlns:ns1= http://DefaultNamespace; jobStatusReturn xsi:type=ns2:QueryBean xmlns:ns2= http://rpc.xml.coldfusion; columnList soapenc:arrayType=xsd:string[1] xsi:type=soapenc:Array xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; columnList xsi:type=xsd:stringPRODUCTIONSTATUS/columnList /columnList data soapenc:arrayType=xsd:anyType[][1] xsi:type=soapenc:Array xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; data soapenc:arrayType=xsd:anyType[1] xsi:type=soapenc:Array data xsi:type=soapenc:stringDISK SENT/data /data /data /jobStatusReturn /ns1:jobStatusResponse /soapenv:Body /soapenv:Envelop ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334036 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
XPATH
Can someone help me figure out the XPATH of the node that contains DISK SENT? Thanks! Chad ?xml version=1.0 encoding=UTF-8? soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body ns1:jobStatusResponse soapenv:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/; xmlns:ns1=http://DefaultNamespace; jobStatusReturn xsi:type=ns2:QueryBean xmlns:ns2=http://rpc.xml.coldfusion; columnList soapenc:arrayType=xsd:string[1] xsi:type=soapenc:Array xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; columnList xsi:type=xsd:stringPRODUCTIONSTATUS/columnList /columnList data soapenc:arrayType=xsd:anyType[][1] xsi:type=soapenc:Array xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; data soapenc:arrayType=xsd:anyType[1] xsi:type=soapenc:Array data xsi:type=soapenc:stringDISK SENT/data /data /data /jobStatusReturn /ns1:jobStatusResponse /soapenv:Body /soapenv:Envelop ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334006 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: XPATH
Chad, There is a great discussion of exactly this issue here: http://www.bennadel.com/blog/494-Stripping-XML-Name-Spaces-And-Node-Prefixes-From-ColdFusion-XML-Data-To-Simplify-XPath-.htm Basically - xpath and namespaces are a pain in cf. Check the comments of the blog post, they offer a good number of good ideas. Mark On Thu, May 27, 2010 at 3:06 AM, Chad Gray cg...@careyweb.com wrote: Can someone help me figure out the XPATH of the node that contains DISK SENT? Thanks! Chad ?xml version=1.0 encoding=UTF-8? soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; soapenv:Body ns1:jobStatusResponse soapenv:encodingStyle= http://schemas.xmlsoap.org/soap/encoding/; xmlns:ns1= http://DefaultNamespace; jobStatusReturn xsi:type=ns2:QueryBean xmlns:ns2= http://rpc.xml.coldfusion; columnList soapenc:arrayType=xsd:string[1] xsi:type=soapenc:Array xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; columnList xsi:type=xsd:stringPRODUCTIONSTATUS/columnList /columnList data soapenc:arrayType=xsd:anyType[][1] xsi:type=soapenc:Array xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/; data soapenc:arrayType=xsd:anyType[1] xsi:type=soapenc:Array data xsi:type=soapenc:stringDISK SENT/data /data /data /jobStatusReturn /ns1:jobStatusResponse /soapenv:Body /soapenv:Envelop ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334029 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
XMLSearch help - xpath not working as expected
Hello, I am developing using CF9. I am fetching RSS feed from twitter but XmlSearch is unable to return array of entry elements in the xml. Please look into the following code: I can't be using CFFEED tag, since this project has to work on a CF 7 server. cfset sourceUrl = http://search.twitter.com/search.atom?lang=enq=ColdFusion+OR+%23CF+OR+CFML; / cfhttp result=feedRaw url = #sourceUrl# timeout=60 / cfset feed = XMLParse(trim(feedRaw.fileContent), false) / The above part works fine. Problem is that none of the following lines work as expected. I expect to get an array of xml elements entry. cfset items = xmlSearch(feed, //entry) / I have also tried using: 1. //feed/entry 2. /feed/entry 3. entry 4. /*/entry 5. //*/entry Nothing is helping. If you read W3C's page () you'll see various examples, all of them are failing. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327663 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: XMLSearch help - xpath not working as expected
entry is the wrong entity for an RSS feed. The entry you want is item so you'd want xmlSearch(feed,//item) hth -- s. isaac dealey :: AutLabs Creating meaningful employment for people with Autism http://www.autlabs.com ph: 817.385.0301 http://onTap.riaforge.org/blog ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327664 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: XMLSearch help - xpath not working as expected
I think this will be to do with the default namespace in the xml document. A quick google should tell you all you need to know on that, but the upshot is that you will need to use a colon (e.g. a blank namespace) before entity names, i.e.: cfset items = XmlSearch(feed, '//:entry') / HTH Dominic 2009/10/26 Sameer Gupta guptasam...@msn.com Hello, I am developing using CF9. I am fetching RSS feed from twitter but XmlSearch is unable to return array of entry elements in the xml. Please look into the following code: I can't be using CFFEED tag, since this project has to work on a CF 7 server. cfset sourceUrl = http://search.twitter.com/search.atom?lang=enq=ColdFusion+OR+%23CF+OR+CFML; / cfhttp result=feedRaw url = #sourceUrl# timeout=60 / cfset feed = XMLParse(trim(feedRaw.fileContent), false) / The above part works fine. Problem is that none of the following lines work as expected. I expect to get an array of xml elements entry. cfset items = xmlSearch(feed, //entry) / I have also tried using: 1. //feed/entry 2. /feed/entry 3. entry 4. /*/entry 5. //*/entry Nothing is helping. If you read W3C's page () you'll see various examples, all of them are failing. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327665 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: XMLSearch help - xpath not working as expected
Thanks for responding Isaac. I was using an Atom feed and therefore had to use entry instead of item. It worked following the other advice. Best Sam ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327671 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: XMLSearch help - xpath not working as expected
I think this will be to do with the default namespace in the xml document. A quick google should tell you all you need to know on that, but the upshot is that you will need to use a colon (e.g. a blank namespace) before entity names, i.e.: cfset items = XmlSearch(feed, '//:entry') / HTH Dominic 2009/10/26 Sameer Gupta guptasam...@msn.com Thanks. It worked with /:feed/:entry cfset items = XmlSearch(feed, /:feed/:entry) / Best Sameer ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327672 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: XMLSearch help - xpath not working as expected
Thanks for responding Isaac. I was using an Atom feed and therefore had to use entry instead of item. It worked following the other advice. Ahh, well I read RSS in your original message and had just gone and double-checked the RSS link on my own twitter profile. :) Glad you got it figured out. -- s. isaac dealey :: AutLabs Creating meaningful employment for people with Autism http://www.autlabs.com ph: 817.385.0301 http://onTap.riaforge.org/blog ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327679 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
CF, XML, XSLT, XPath and XHTML.
I am attempting to use the CF xml functionality to parse up an xhtml document and I can not seem to get any results. Is there something about this world I am not getting? No matter how I try to reference any xml nodes I just get a blank result. spb.cfm cfsilent cfsetting showdebugoutput=no cfhttp url=http://www.spb.ca.gov/jobs/exams/exam_start.htm; resolveurl=yes/ cfset xmlObj = xmlParse(cfhttp.FileContent) cffile action=read file=#getDirectoryFromPath(getCurrentTemplatePath())#spb.xsl variable=xslt /cfsilent!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleSPB/title /head body cfoutput#htmlCodeFormat(xmlTransform(xmlObj,xslt))#/cfoutput cfdump var=#xmlSearch(xmlObj,'//option')# hr color=#00 size=10 / cfoutput#htmlCodeFormat(cfhttp.FileContent)#/cfoutput /body /html spb.sxl --- ?xml version=1.0 encoding=utf-8?!-- DWXMLSource=http://www.spb.ca.gov/jobs/exams/exam_start.htm; --!DOCTYPE xsl:stylesheet [ !ENTITY nbsp #160; !ENTITY copy #169; !ENTITY reg#174; !ENTITY trade #8482; !ENTITY mdash #8212; !ENTITY ldquo #8220; !ENTITY rdquo #8221; !ENTITY pound #163; !ENTITY yen#165; !ENTITY euro #8364; ] xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xsl:output method=html encoding=utf-8/ xsl:template match=/ xsl:value-of select=//option / /xsl:template /xsl:stylesheet ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305157 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: CF, XML, XSLT, XPath and XHTML.
Hi Ian, This line creates a default namespace for the xml which may be your problem: html xmlns=http://www.w3.org/1999/xhtml; To match any node in an xml document with a default namespace, you will need to add the default namespace to your xpath which is just a colon: xsl:value-of select=//:option / HTH Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305160 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: CF, XML, XSLT, XPath and XHTML.
I found some Python discussions on XPath and XHTML that indicated I need another name space in my xslt. xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:xhtml=http://www.w3.org/1999/xhtml; xsl:output method=html encoding=utf-8/ xsl:template match=/ xsl:for-each select=//xhtml:option xsl:value-of select=. / /xsl:for-each /xsl:template /xsl:stylesheet This seems to be working. Is there any advice for me on this concept? How would I use this second name space in a ColdFusion xmlSearch() function? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305161 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: CF, XML, XSLT, XPath and XHTML.
Dominic Watson wrote: Hi Ian, This line creates a default namespace for the xml which may be your problem: html xmlns=http://www.w3.org/1999/xhtml; Yes, I did discover that this was a name space issue. To match any node in an xml document with a default namespace, you will need to add the default namespace to your xpath which is just a colon: xsl:value-of select=//:option / HTH I tried this solution and I get this error: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Prefix must resolve to a namespace: But adding a another name space parameter to my xsl seems to work well. xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:xhtml=http://www.w3.org/1999/xhtml; xsl:for-each select=//xhtml:option As I asked in my other post. How does one make use of multiple name spaces like this in the ColdFusion xml functions such as xmlSearch? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305163 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: CF, XML, XSLT, XPath and XHTML.
I'm not sure if this will work for you, but it may help: http://www.talkingtree.com/blog/index.cfm/2005/11/18/XmlSearchNoNameName space Read through the comments for the xmlSearch wildcards. You may be able to skip over the namespaces with the wildcards. m!ke -Original Message- From: Ian Skinner [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 13, 2008 10:17 AM To: CF-Talk Subject: Re: CF, XML, XSLT, XPath and XHTML. Dominic Watson wrote: Hi Ian, This line creates a default namespace for the xml which may be your problem: html xmlns=http://www.w3.org/1999/xhtml; Yes, I did discover that this was a name space issue. To match any node in an xml document with a default namespace, you will need to add the default namespace to your xpath which is just a colon: xsl:value-of select=//:option / HTH I tried this solution and I get this error: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Prefix must resolve to a namespace: But adding a another name space parameter to my xsl seems to work well. xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:xhtml=http://www.w3.org/1999/xhtml; . xsl:for-each select=//xhtml:option As I asked in my other post. How does one make use of multiple name spaces like this in the ColdFusion xml functions such as xmlSearch? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305176 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: CF, XML, XSLT, XPath and XHTML.
aXPathSearchResults = oXml.Search('//xHtml: Should be: aXPathSearchResults = oXml.Search('//xHtml:option'); -- Blog it up: http://fusion.dominicwatson.co.uk ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305186 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: CF, XML, XSLT, XPath and XHTML.
How would I use this second name space in a ColdFusion xmlSearch() function? This is a tricky one. For xslt, what you are doing there is mapping any namespaces in the target xml with a prefix. From then on, using the prefix in your xslt will work great. For XmlSearch however, there is no ColdFusion tool for mapping namespaces to prefixes so you can only use the ':' default namespace prefix. If you have more than one default namespace in your xml, you are left without a paddle (using ':' won't work). Enter betterXml. I have made a couple of components to utilize xpath better in coldfusion (mainly for maintaining xml files but useful in other situations). The xmlReader component has a MapNamespace method that does what it says on the tin. You could do: oXml = createObject('component', 'betterXml.betterXmlReader').init(xmlFile); oXml.MapNamespace('http://www.w3.org/1999/xhtml', 'xHtml'); aXPathSearchResults = oXml.Search('//xHtml: Check out my blogpost on this: http://fusion.dominicwatson.co.uk/2008/03/xmlsearch-and-default-namespaces.html The project is on riaforge: http://betterxml.riaforge.org HTH Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305185 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: XPath with namespace
Cheers Dom and Ian, the //:LookAt worked. Thanks for the references too. Adrian -Original Message- From: Dominic Watson Sent: 25 March 2008 20:02 To: CF-Talk Subject: Re: XPath with namespace This blog entry discuss this in a bit more detail. http://www.talkingtree.com/blog/index.cfm/2005/11/18/XmlSearchNoNameNamespac e It does but it also misses a point that this IS a missing feature of ColdFusion. The solution works fine when you only have one default namespace being used (as in Ade's example) but it falls down when there are more than one. Here is a recent thread from here that discusses it (with no current solution other than ugly XPath): http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55440 Dominic On 25/03/2008, Ian Skinner [EMAIL PROTECTED] wrote: Dominic Watson wrote: Try cfdump var=#XMLSearch(x, '//:LookAt')# That specifies the 'default' or 'no name' namespace which is what is being used in that xml. There can be a problem when there is more than one namespace declared without a prefix but it doesn't seem that that comes up a lot (though it does with the google maps geocoder). You should be ok here though. Dominic This blog entry discuss this in a bit more detail. http://www.talkingtree.com/blog/index.cfm/2005/11/18/XmlSearchNoNameNamespac e ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:302089 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
XPath with namespace
Hey all, got this XML: cfsavecontent variable=x?xml version=1.0 encoding=UTF-8? kml xmlns=http://earth.google.com/kml/2.0; Placemark nameLondon SE14 6QP/name addressLondon SE14 6QP/address styleUrlroot://styleMaps#default+nicon=0x304+hicon=0x314/styleUrl Point coordinates-0.030183,51.471709,0/coordinates /Point LookAt longitude-0.030183/longitude latitude51.471709/latitude range1000.00/range /LookAt /Placemark /kml/cfsavecontent Which I want to navigate to the long and lat values. I wanted to do an XMLSearch but the xmlns attribute is stopping it from working. The following code to test it highlights the problem. If you remove the namespace it works. Any ideas on how to get this to work other than drilling down with XmlChildren syntax. cfset x = XMLParse(x, false) cfdump var=#x# cfdump var=#XMLSearch(x, '//LookAt')# Cheers. Adrian Lynch http://www.adrianlynch.co.uk/ ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:302034 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: XPath with namespace
Try cfdump var=#XMLSearch(x, '//:LookAt')# That specifies the 'default' or 'no name' namespace which is what is being used in that xml. There can be a problem when there is more than one namespace declared without a prefix but it doesn't seem that that comes up a lot (though it does with the google maps geocoder). You should be ok here though. Dominic On 25/03/2008, Adrian Lynch [EMAIL PROTECTED] wrote: Hey all, got this XML: cfsavecontent variable=x?xml version=1.0 encoding=UTF-8? kml xmlns=http://earth.google.com/kml/2.0; Placemark nameLondon SE14 6QP/name addressLondon SE14 6QP/address styleUrlroot://styleMaps#default+nicon=0x304+hicon=0x314/styleUrl Point coordinates-0.030183,51.471709,0/coordinates /Point LookAt longitude-0.030183/longitude latitude51.471709/latitude range1000.00/range /LookAt /Placemark /kml/cfsavecontent Which I want to navigate to the long and lat values. I wanted to do an XMLSearch but the xmlns attribute is stopping it from working. The following code to test it highlights the problem. If you remove the namespace it works. Any ideas on how to get this to work other than drilling down with XmlChildren syntax. cfset x = XMLParse(x, false) cfdump var=#x# cfdump var=#XMLSearch(x, '//LookAt')# Cheers. Adrian Lynch http://www.adrianlynch.co.uk/ ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:302035 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: XPath with namespace
Dominic Watson wrote: Try cfdump var=#XMLSearch(x, '//:LookAt')# That specifies the 'default' or 'no name' namespace which is what is being used in that xml. There can be a problem when there is more than one namespace declared without a prefix but it doesn't seem that that comes up a lot (though it does with the google maps geocoder). You should be ok here though. Dominic This blog entry discuss this in a bit more detail. http://www.talkingtree.com/blog/index.cfm/2005/11/18/XmlSearchNoNameNamespace ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:302036 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: XPath with namespace
This blog entry discuss this in a bit more detail. http://www.talkingtree.com/blog/index.cfm/2005/11/18/XmlSearchNoNameNamespace It does but it also misses a point that this IS a missing feature of ColdFusion. The solution works fine when you only have one default namespace being used (as in Ade's example) but it falls down when there are more than one. Here is a recent thread from here that discusses it (with no current solution other than ugly XPath): http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55440 Dominic On 25/03/2008, Ian Skinner [EMAIL PROTECTED] wrote: Dominic Watson wrote: Try cfdump var=#XMLSearch(x, '//:LookAt')# That specifies the 'default' or 'no name' namespace which is what is being used in that xml. There can be a problem when there is more than one namespace declared without a prefix but it doesn't seem that that comes up a lot (though it does with the google maps geocoder). You should be ok here though. Dominic This blog entry discuss this in a bit more detail. http://www.talkingtree.com/blog/index.cfm/2005/11/18/XmlSearchNoNameNamespace ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:302039 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Mapping prefixes to XML namespaces for XPath searches
I cracked it: http://fusion.dominicwatson.co.uk/2008/03/xmlsearch-and-default-namespaces.html Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:302065 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: CFCUnit javax/xml/xpath/XPathExpressionException error
Finally got it working. I wasn't able to reproduce the error, but it was obviously a syntax problem in my build.xml file. I'm posting this in case anyone is looking for a sample build.xml file for CFCUnit. This is what worked for me. My test project\cfc structure c:\cfusionmx\wwwroot\CFCUnit_Example\com\AllTests.cfc ?xml version=1.0 encoding=UTF-8? project default=test name=MyTest basedir=. property name=cfcUnitLib value=c:\cfusionmx\wwwroot\cfcunit\lib / property name=hostname value=127.0.0.1 / property name=port value=8500 / echo message=cfcUnitLib ${cfcUnitLib} / echo message=hostname ${hostname} / echo message=port ${port} / taskdef resource=org/cfcunit/ant/antlib.xml classpath pathelement location=${cfcUnitLib}\ant-cfcunit.jar/ /classpath /taskdef target name=test cfcunit verbose=true haltonfailure=true haltonerror=true showstacktrace=true service hostname=${hostname} port=${port}/ testclass name=CFCUnit_Example.com.AllTests/ /cfcunit /target /project Hope this helps someone ~| Get involved in the latest ColdFusion discussions, product development sharing, and articles on the Adobe Labs wiki. http://labs/adobe.com/wiki/index.php/ColdFusion_8 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289801 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Using XPath to do CRUD ops on XML
I have just released an initial version of a component that makes CRUD operations on XML in CF6 7 a breeze (both in process speed and amount of code). It will work in CF8 but I am not sure it is neccessary(?). Riaforge: http://betterxml.riaforge.org/ More info: http://fusion.dominicwatson.co.uk/2007/09/betterxml-beta-release.html Here is a quick example that opens an XML file, removes all the comments and then writes back to file: cfinvoke component=BetterXML_Editor method=init src=#myFile# returnVariable=xmlFile/ cfscript xmlFile.Delete('//comment()'); xmlFile.Write(myFile); /cfscript Regards, Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~| Get involved in the latest ColdFusion discussions, product development sharing, and articles on the Adobe Labs wiki. http://labs/adobe.com/wiki/index.php/ColdFusion_8 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289708 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
CFCUnit javax/xml/xpath/XPathExpressionException error
I'm just trying my hand at creating an ant task and can't figure out this error. Can anyone tell me what this error means or typical causes? c:\CFusionMX\wwwroot\CFCUnit_Example\build.xml:24: Could not create type cfcunit due to java.lang.NoClassDefFoundError: javax/xml/xpath/XPathExpressionException TIA Janet ~| Enterprise web applications, build robust, secure scalable apps today - Try it now ColdFusion Today ColdFusion 8 beta - Build next generation apps Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289792 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
xmlsearch and xpath
Question: Can an xpath contain conditional logic which looks at a node's xmltext, NOT just an attribute value? For instance: root itemhello world/item itemspam/item /root What xpath would find all item nodes with an xmltext of spam? Thanks ~Brad ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264324 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: xmlsearch and xpath
Can an xpath contain conditional logic which looks at a node's xmltext, NOT just an attribute value? For instance: root itemhello world/item itemspam/item /root What xpath would find all item nodes with an xmltext of spam? I think this should work: //item[. = 'spam'] Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264334 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: xmlsearch and xpath
Thanks Dave. After some continued Googling I also fund some references to a self() function as in [self::text()=123] Not sure what the difference is though. ~Brad -Original Message- From: Dave Watts [mailto:[EMAIL PROTECTED] Sent: Monday, December 18, 2006 1:05 PM To: CF-Talk Subject: RE: xmlsearch and xpath Can an xpath contain conditional logic which looks at a node's xmltext, NOT just an attribute value? For instance: root itemhello world/item itemspam/item /root What xpath would find all item nodes with an xmltext of spam? I think this should work: //item[. = 'spam'] ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264339 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: xmlsearch and xpath
My bad, I meant to type text() function. :) ~Brad -Original Message- From: Brad Wood Sent: Monday, December 18, 2006 1:18 PM To: CF-Talk Subject: RE: xmlsearch and xpath Thanks Dave. After some continued Googling I also fund some references to a self() function as in [self::text()=123] Not sure what the difference is though. ~Brad ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264342 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
SOLVED RE: xmlsearch and xpath
Ahhh, thank you! ~Brad There is no difference . = self(). [.] is just a shortcut for self(). There are several of these shortcuts. ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264344 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
CF, XML Default namespace, and XPath bug
Hello, We have been dealing with this issue off-and-on for a few months now so I really hope someone has some insight to this issue for us. We've noticed that if an XML document has a default namespace defined using the 'xmlns' attribute, eg... ?xml version=1.0 encoding=UTF-8? BackgroundReports xmlns=http://ns.hr-xml.org/2006-02-28; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://ns.hr-xml.org/2006-02-28 file:///C:/BackgroundReports.xsd version=2006-02-28 xml:lang=en [...] Then XPath requires a colon prefix to work. So the regular '/BackgroundReports/@version' does not work but '/:BackgroundReports/@version' does. This causes us problems because what if the user did not specify a default namespace in the document and rather the schema file was noted to the parser separately? Now we have to have two versions of XPath for each action. If I remove the default namespace, then the path without the colon works, but now the document can not be validated whilst being parsed. Does anyone have any tips/tricks to get ColdFusion to work well with a XML default namespaces? Best regards, Kervin ~| 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:247179 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: CF, XML Default namespace, and XPath bug
Use local-name(). That ignores the namespace declaration: xsl:for-each select=//*[local-name()='item'] | //*[local-name()='entry'] ... /xsl:for-each On 7/20/06, Kervin L. Pierre [EMAIL PROTECTED] wrote: Hello, We have been dealing with this issue off-and-on for a few months now so I really hope someone has some insight to this issue for us. We've noticed that if an XML document has a default namespace defined using the 'xmlns' attribute, eg... ?xml version=1.0 encoding=UTF-8? BackgroundReports xmlns=http://ns.hr-xml.org/2006-02-28; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://ns.hr-xml.org/2006-02-28 file:///C:/BackgroundReports.xsd version=2006-02-28 xml:lang=en [...] Then XPath requires a colon prefix to work. So the regular '/BackgroundReports/@version' does not work but '/:BackgroundReports/@version' does. This causes us problems because what if the user did not specify a default namespace in the document and rather the schema file was noted to the parser separately? Now we have to have two versions of XPath for each action. If I remove the default namespace, then the path without the colon works, but now the document can not be validated whilst being parsed. Does anyone have any tips/tricks to get ColdFusion to work well with a XML default namespaces? Best regards, Kervin ~| 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:247182 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
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 cfset MyPostCodes = XMLSearch(GeoCodeXML,//PostalCodeNumber) 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:246152 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 cfset MyPostCodes = XMLSearch(GeoCodeXML,//PostalCodeNumber) 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
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 cfset MyPostCodes = XMLSearch(GeoCodeXML,//PostalCodeNumber) 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
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 cfset MyPostCodes = XMLSearch(GeoCodeXML,//PostalCodeNumber) 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
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 cfset MyPostCodes = XMLSearch(GeoCodeXML,//PostalCodeNumber) 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
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 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
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
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! cfsetting showdebugoutput=false / cfsavecontent variable=strXmlData ?xml version=1.0 encoding=utf-8? soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; soap:Body doDirectorySearch xmlns=http://xstandard.com/2004/web-services; langen/lang searchForxxx/searchFor filterBysnippets/filterBy /doDirectorySearch /soap:Body /soap:Envelope /cfsavecontent cfset xmlData = XmlParse( strXmlData, true ) / cfset results = XmlSearch( xmlData, //doDirectorySearch ) / cfdump var=#results# / cfdump var=#xmlData# / ... Ben Nadel www.bennadel.com ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240837 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. cfset results = xmlSearch(xmlPacket, /soap:Envelope/soap:Body/child::*) 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! cfsetting showdebugoutput=false / cfsavecontent variable=strXmlData ?xml version=1.0 encoding=utf-8? soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; soap:Body doDirectorySearch xmlns=http://xstandard.com/2004/web-services; langen/lang searchForxxx/searchFor filterBysnippets/filterBy /doDirectorySearch /soap:Body /soap:Envelope /cfsavecontent cfset xmlData = XmlParse( strXmlData, true ) / cfset results = XmlSearch( xmlData, //doDirectorySearch ) / cfdump var=#results# / cfdump var=#xmlData# / 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
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! cfsetting showdebugoutput=false / cfsavecontent variable=strXmlData ?xml version=1.0 encoding=utf-8? soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; soap:Body doDirectorySearch xmlns=http://xstandard.com/2004/web-services; langen/lang searchForxxx/searchFor filterBysnippets/filterBy /doDirectorySearch /soap:Body /soap:Envelope /cfsavecontent cfset xmlData = XmlParse( strXmlData, true ) / cfset results = XmlSearch( xmlData, //doDirectorySearch ) / cfdump var=#results# / cfdump var=#xmlData# / 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
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
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: cfset results = xmlSearch(xmlPacket, //*[name()='searchFor']) pcfdump var=#results#/p pcfoutput#results[1].XmlText#/cfoutput/p 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
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: cfset results = xmlSearch(xmlPacket, //*[name()='searchFor']) pcfdump var=#results#/p pcfoutput#results[1].XmlText#/cfoutput/p 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
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
CFUNITED-06 interview 12: Jeff Peters XML, XPath, and XSLT
In this issue of ColdFusion conference and training news: * Fusetalk Forum on CFUNITED! * CFLive - Hal Helms Thursday 12:30pm EST via breeze * Special Thanks to CFDynamics * Only 10 days left on timely bird price - ends 3/31/06 * Interview with Jeff Peters XML, XPath, and XSLT * Interview with Simon Horwith BOF: Celebrity Death Match CFUNITED is the premier ColdFusion Conference near Washington DC 6/28-7/1/06 (Four whole days!) Check out speakers and topics at http://www.cfunited.com/ - Michael Smith TeraTech, Inc It is simply the premier CF conference, with excellent training by CF gurus. Anyone working in CF can go there and meet others who can help you with your current projects or give you new ideas to tuck away for future projects. I stumbled upon CFUnited for the first time last year, and went without any idea of what it would be like. It was so fantastic, I had to go again this year for the advanced CF track! - Judy P. (previous year Attendee) Have 3 years of CF and love helping other developers? http://www.teratech.com/index.cfm?go=About.JobDetailJobID=7 Conference and training news * Upcoming TeraTech classes Cost $59 - $349 see http://www.teratech.com/training/ for more details and registration CF101 - Welcome to ColdFusion May 2 2006 CF102 - Intro to ColdFusion May 9 2006 CF201 - Intermediate ColdFusion May 16 2006 FB101 - Intro to FuseboxMay 23 2006 FB201 - Intermediate FuseboxJun 6 2006 * Pre-conference classes Cost $449 see http://www.cfunited.com/classes06.cfm for more details and registration Register before March 31st and enter to win a free 8 GB memory stick! Location: Bethesda North Marriott and Conference Center CU210 Leader of the Pack (strategies for building better software) - Simon Horwith - Monday 6/26 CU211 Fundamentals of Relational Database - Kurtis D. Leatham - Monday 6/26 CU212 ColdFusion Server Administration: JRun J2EE Deployment - Adam Wayne Lehman - Monday 6/26 CU213 Testing ColdFusion - John Paul Ashenfelter - Monday 6/26 CU214 Ajax intensive for ColdFusion Developers - Rob Gonda - Tuesday 6/27 CU215 XML, XPath, and XSLT for ColdFusion Developers - Jeff Peters - Tuesday 6/27 CU216 Domain Modeling - Hal Helms - Tuesday 6/27 CU217 Beyond Basic SQL for CF - Nate Nelson - Tuesday 6/27 CFUNITED NEWS! * The First 750 registrations will get our cool new laptop book bag, courtesy of our platinum and gold sponsors! Don't settle for the tote, register today! See photo at http://www.cfunited.com/bag.cfm * Fusetalk Forum now on CFUNITED! Start talking to other register conference attendees today. If you are registered as an attendee, login into http://www.cfunited.com/login.cfm Discuss topics, arrange ride sharing or meeting at the event. Thanks Fusetalk for letting CFUNITED use your cool message board! See http://www.fusetalk.com/ for more info. -- Our Common Interest page is coming soon too! * 320 people are already registered for CFUNITED-06 and the main hotel is full! (That is more people than the same time last year). * We have an over flow hotel: Bethesda Marriott (Located about 1.5 miles from the conference center - there will be a shuttle to the conference center all day) 5151 Pooks Hill Road Bethesda MD 20814 To make reservations call: 1.800.228.9290 Use the group code: CFU See http://www.cfunited.com/travel.cfm for more details. *CFLive Hear CFUNITED speakers from your office via breeze talks every Thursday 12:30pm - 1pm EST. Learn new tips and ask questions live. Hal Helms on DuckTyping in CFCs, Design Patterns, Variables Conditions Thu, Mar 23, 2006 at 12:30 PM US/Eastern http://coldfusion.meetup.com/17/events/4874948/ Future talks 3/30/06 Jeremy Kadlec SQL Server tips 4/6/06 Sean Corfield Managing CFCs with Factories, Objects and Persistence 4/13/06 John Paul Ashenfelter Agile Programming 4/20/06 Simeon Bateman CFEclipse 5/4/06 Steve Ritler Farcry CMS 5/11/06 Maxim Porges Secrets of Top Notch Teams * www.cfunited.com is hosted by CFDynamics. CFDynamics is known as a leader in the ColdFusion Web hosting community in providing reliable and powerful hosting. With hosting customers across the globe, we know and understand the standards that developers have come to expect in a host. Our expert administrators fine-tune our servers to provide ideal efficiency and reliability as well as top-notch performance. CFDynamics is your partner in web hosting and we will do what it takes to keep your site running smoothly. To learn more about our Web hosting services: http://www.cfdynamics.com * Only 3 months until CFUNITED (96 days). * Only 10 days left on timely bird price - ends Friday 3/31/06 * Can't afford to come for 4 days? Or can't take time off work during the week? Come to our Saturday only CFUNITED event. * Full time students and umemployed programmers substantial discounts available - email liz (at) teratech.com for your discount code
RE: Need help with tricky XPath syntax
Larry If you have not solved this issue yet, I find this a great resource for xslt/xpath questions. [http://www.zvon.org/xxl/XSLTreference/Output/index.html] I have always been able to figure out what I need from their tutorials and examples. If I have time later today, I'll take a crack at your issue, but you may very well solve it before I get a chance. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227267 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: Need help with tricky XPath syntax
Already resolved (the final couple of messages in my dialogue with Hua Wei were rejected by the list for some reason). Thanks anyway, though. -- LBA Ian Skinner wrote: Larry If you have not solved this issue yet, I find this a great resource for xslt/xpath questions. [http://www.zvon.org/xxl/XSLTreference/Output/index.html] I have always been able to figure out what I need from their tutorials and examples. If I have time later today, I'll take a crack at your issue, but you may very well solve it before I get a chance. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227307 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
Need help with tricky XPath syntax
Howdy -- I'm having difficulty crafting a tricky XPath expression and would appreciate help from any XPath gurus out there. Sample document: IDMS identity idms_id=90282 sponsorship status=Inactive start_date=Jul 20 2004Provost/sponsorship sponsorship status=Active start_date=May 28 2004 Residents/sponsorship /identity identity idms_id=900018891 sponsorship status=Active start_date=May 6 2003HR/sponsorship sponsorship status=Active start_date=May 9 2003Provost/sponsorship sponsorship status=Active start_date=May 8 2003UMA/sponsorship /identity /IDMS I need an XPath expression that will extract the array of identity elements with Active Provost sponsorship. Applying the expression I seek against the above document would yield a one-element array containing only the second identity element from the document. Extracting the identity elements with Provost sponsorship is trivial: /IDMS/identity[sponsorship='Provost'] The tricky part seems to be restricting the selection to only the *Active* Provost sponsorships. I've tried a zillion permutations on the following as the second argument to my XMLSearch() call, but none of my experiments has worked right yet: /IDMS/identity[sponsorship='Provost' and [EMAIL PROTECTED]'Active']] I've looked through all the XPath tutorials I could find but couldn't find an answer to this question (at least, not an answer I could understand). Looking at some complex examples I've found in some tutorials, I've gotten a vague sense that somehow id() and self:: are going to be involved in a solution, but otherwise I'm just totally lost. Greatly appreciate any help anyone can provide. -- Larry Afrin Medical University of South Carolina ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227167 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: Need help with tricky XPath syntax
Larry, Not sure whether this is what you are looking for: /IDMS/identity/[EMAIL PROTECTED]'Active' and text()='Provost'] Returns this element: sponsorship status=Active start_date=May 9 2003Provost/sponsorship Hua -Original Message- From: Lawrence B. Afrin, M.D. [mailto:[EMAIL PROTECTED] Sent: Friday, December 16, 2005 11:25 AM To: CF-Talk Subject: Need help with tricky XPath syntax Howdy -- I'm having difficulty crafting a tricky XPath expression and would appreciate help from any XPath gurus out there. Sample document: IDMS identity idms_id=90282 sponsorship status=Inactive start_date=Jul 20 2004Provost/sponsorship sponsorship status=Active start_date=May 28 2004 Residents/sponsorship /identity identity idms_id=900018891 sponsorship status=Active start_date=May 6 2003HR/sponsorship sponsorship status=Active start_date=May 9 2003Provost/sponsorship sponsorship status=Active start_date=May 8 2003UMA/sponsorship /identity /IDMS I need an XPath expression that will extract the array of identity elements with Active Provost sponsorship. Applying the expression I seek against the above document would yield a one-element array containing only the second identity element from the document. Extracting the identity elements with Provost sponsorship is trivial: /IDMS/identity[sponsorship='Provost'] The tricky part seems to be restricting the selection to only the *Active* Provost sponsorships. I've tried a zillion permutations on the following as the second argument to my XMLSearch() call, but none of my experiments has worked right yet: /IDMS/identity[sponsorship='Provost' and [EMAIL PROTECTED]'Active']] I've looked through all the XPath tutorials I could find but couldn't find an answer to this question (at least, not an answer I could understand). Looking at some complex examples I've found in some tutorials, I've gotten a vague sense that somehow id() and self:: are going to be involved in a solution, but otherwise I'm just totally lost. Greatly appreciate any help anyone can provide. -- Larry Afrin Medical University of South Carolina ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227181 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: Need help with tricky XPath syntax
Hua -- Thanks, but that's not quite right. I agree that getting the sponsorship element is easy with the expression you provided, but what I actually need is the parent identity element (along with all of its sponsorship subelements) of any sponsorship elements with a status attribute of Active and a text value of Provost. -- LBA Hua Wei wrote: Larry, Not sure whether this is what you are looking for: /IDMS/identity/[EMAIL PROTECTED]'Active' and text()='Provost'] Returns this element: sponsorship status=Active start_date=May 9 2003Provost/sponsorship Hua -Original Message- From: Lawrence B. Afrin, M.D. [mailto:[EMAIL PROTECTED] Sent: Friday, December 16, 2005 11:25 AM To: CF-Talk Subject: Need help with tricky XPath syntax Howdy -- I'm having difficulty crafting a tricky XPath expression and would appreciate help from any XPath gurus out there. Sample document: IDMS identity idms_id=90282 sponsorship status=Inactive start_date=Jul 20 2004Provost/sponsorship sponsorship status=Active start_date=May 28 2004 Residents/sponsorship /identity identity idms_id=900018891 sponsorship status=Active start_date=May 6 2003HR/sponsorship sponsorship status=Active start_date=May 9 2003Provost/sponsorship sponsorship status=Active start_date=May 8 2003UMA/sponsorship /identity /IDMS I need an XPath expression that will extract the array of identity elements with Active Provost sponsorship. Applying the expression I seek against the above document would yield a one-element array containing only the second identity element from the document. Extracting the identity elements with Provost sponsorship is trivial: /IDMS/identity[sponsorship='Provost'] The tricky part seems to be restricting the selection to only the *Active* Provost sponsorships. I've tried a zillion permutations on the following as the second argument to my XMLSearch() call, but none of my experiments has worked right yet: /IDMS/identity[sponsorship='Provost' and [EMAIL PROTECTED]'Active']] I've looked through all the XPath tutorials I could find but couldn't find an answer to this question (at least, not an answer I could understand). Looking at some complex examples I've found in some tutorials, I've gotten a vague sense that somehow id() and self:: are going to be involved in a solution, but otherwise I'm just totally lost. Greatly appreciate any help anyone can provide. -- Larry Afrin Medical University of South Carolina ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227190 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: XML / XSLT / XPath
I don't have any real experience with XML other than editing some config files, parsing some xml docs and tinkering with XSLT over the last couple weekends. I guess I am looking for a book that hits on all the topics but not too deep. I can then get more specific books as the need arises. Knowing this, any new recommendations? You could go with XML 1.1 Bible by Elliotte Rusty Harold. It touches a wide range of XML related topics. It's a huge book, but it may be a good starting point. From there you can move to more specific titles. I figured the same would probably be true of the XML For Dummies book. s. isaac dealey 954.522.6080 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://www.fusiontap.com http://coldfusion.sys-con.com/author/4806Dealey.htm ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218560 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
OT: XML / XSLT / XPath
Anyone have any book recommendations for XML/XSLT/Xpath ? Thanks! Mike T. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218542 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: OT: XML / XSLT / XPath
soory not a book rec' but the new dw has some ass kickin xml/xls tools! ~Dave the disruptor~ Some people just don't appreciate how difficult it is to dispense wisdom and abuse at the same time. From: Michael Tangorre [EMAIL PROTECTED] Sent: Saturday, September 17, 2005 4:32 PM To: CF-Talk cf-talk@houseoffusion.com Subject: OT: XML / XSLT / XPath Anyone have any book recommendations for XML/XSLT/Xpath ? Thanks! Mike T. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218543 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: XML / XSLT / XPath
Anyone have any book recommendations for XML/XSLT/Xpath ? That's a pretty huge range of topics :-) I have a few small reviews available on my website. See under Book Reviews XML Please feel free to ask more questions about a specific book or topic Massimo Foti Tools for ColdFusion and Dreamweaver developers: http://www.massimocorner.com ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218545 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: XML / XSLT / XPath
From: Massimo, Tiziana e Federica [mailto:[EMAIL PROTECTED] That's a pretty huge range of topics :-) I know :-) I don't have any real experience with XML other than editing some config files, parsing some xml docs and tinkering with XSLT over the last couple weekends. I guess I am looking for a book that hits on all the topics but not too deep. I can then get more specific books as the need arises. Knowing this, any new recommendations? Nice site by the way... (make the book links open in new windows :-) ) Mike T ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218546 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: XML / XSLT / XPath
Might want to get the O'reilly XSLT Cookbook as well as joining the Mulberry XSLT listXSLTs are easy once you get past some of the initial shock Mulberry XSLT List - http://www.mulberrytech.com/xsl/xsl-list/ On Sep 17, 2005, at 6:08 PM, Michael Tangorre wrote: From: Massimo, Tiziana e Federica [mailto:[EMAIL PROTECTED] That's a pretty huge range of topics :-) I know :-) I don't have any real experience with XML other than editing some config files, parsing some xml docs and tinkering with XSLT over the last couple weekends. I guess I am looking for a book that hits on all the topics but not too deep. I can then get more specific books as the need arises. Knowing this, any new recommendations? Nice site by the way... (make the book links open in new windows :-) ) Mike T ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218547 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: XML / XSLT / XPath
I don't have any real experience with XML other than editing some config files, parsing some xml docs and tinkering with XSLT over the last couple weekends. I guess I am looking for a book that hits on all the topics but not too deep. I can then get more specific books as the need arises. Knowing this, any new recommendations? You could go with XML 1.1 Bible by Elliotte Rusty Harold. It touches a wide range of XML related topics. It's a huge book, but it may be a good starting point. From there you can move to more specific titles. TOC and sample chapters available here: http://www.cafeconleche.org/books/bible3/ Nice site by the way... (make the book links open in new windows :-) ) Thanks. Those links are old-fashioned, it's up to the user to open them in a new window or not :-) Massimo Foti Tools for ColdFusion and Dreamweaver developers: http://www.massimocorner.com ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218552 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: Compount XPath in xmlSearch()?
Quick apology, I meant compound not compount! On 4/18/05, Brian Kotek [EMAIL PROTECTED] wrote: Does anyone know how to combine expressions in xmlSearch()? I'm trying to select all nodes except where a certain attribute matches a value that I specify. I'm trying this: xmlSearch( xmlObject, '(/employees/employee) and not (/employees/[EMAIL PROTECTED]inactive])' ) but I get the error: Can not convert #BOOLEAN to a NodeList! Thanks, Brian ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:203410 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
Compount XPath in xmlSearch()?
Does anyone know how to combine expressions in xmlSearch()? I'm trying to select all nodes except where a certain attribute matches a value that I specify. I'm trying this: xmlSearch( xmlObject, '(/employees/employee) and not (/employees/[EMAIL PROTECTED]inactive])' ) but I get the error: Can not convert #BOOLEAN to a NodeList! Thanks, Brian ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:203409 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: Compount XPath in xmlSearch()?
That'll return a boolean value (exp1 AND NOT exp2), which isn't what you want. /employees/[EMAIL PROTECTED] != 'inactive'] should get you what you want. cheers, barneyb On 4/18/05, Brian Kotek [EMAIL PROTECTED] wrote: Does anyone know how to combine expressions in xmlSearch()? I'm trying to select all nodes except where a certain attribute matches a value that I specify. I'm trying this: xmlSearch( xmlObject, '(/employees/employee) and not (/employees/[EMAIL PROTECTED]inactive])' ) but I get the error: Can not convert #BOOLEAN to a NodeList! Thanks, Brian -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:203416 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: Compount XPath in xmlSearch()?
Thanks Barney, I arrived at a similar solution that seems to work: xmlSearch( local.circuitXML, '/employees/employee[not(@status=inactive)]' ) and just for future info for anyone who stumbles on this thread, you can specify multiple values to exclude like this: xmlSearch( local.circuitXML, '/employees/employee[not(@status=inactive or @status=probation)]' ) Thanks again Barney! On 4/18/05, Barney Boisvert [EMAIL PROTECTED] wrote: That'll return a boolean value (exp1 AND NOT exp2), which isn't what you want. /employees/[EMAIL PROTECTED] != 'inactive'] should get you what you want. cheers, barneyb On 4/18/05, Brian Kotek [EMAIL PROTECTED] wrote: Does anyone know how to combine expressions in xmlSearch()? I'm trying to select all nodes except where a certain attribute matches a value that I specify. I'm trying this: xmlSearch( xmlObject, '(/employees/employee) and not (/employees/[EMAIL PROTECTED]inactive])' ) but I get the error: Can not convert #BOOLEAN to a NodeList! Thanks, Brian -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:203422 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: CF+XPath
Ona slightly related topic Xmlsearch returns a reference(array of) to the Node(s) it finds it does not return a copy of those nodes...not sure if that is something that has been discussed to much extent Adam H On Thu, 30 Dec 2004 17:08:42 -0700, Figy, Kam [EMAIL PROTECTED] wrote: I've been investigating XmlSearch() and thought I'd share a few notes for anyone interested. XmlSearch() can behave similarly to Query of Queries - but not in its original form. XmlSearch returns an array of matching XML nodes, and that array is not search-able, however its elements ARE; e.g. x = XmlSearch( xml, '/foo/bar[1]' ); y = XmlSearch( x[1], 'baz' ); The really interesting thing is that CF's XPath behaves like a cursor in the XML object - in the example above, you could search x for / and get the whole document again. Hope thats mildly interesting Kam ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189554 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
CF+XPath
I've been investigating XmlSearch() and thought I'd share a few notes for anyone interested. XmlSearch() can behave similarly to Query of Queries - but not in its original form. XmlSearch returns an array of matching XML nodes, and that array is not search-able, however its elements ARE; e.g. x = XmlSearch( xml, '/foo/bar[1]' ); y = XmlSearch( x[1], 'baz' ); The really interesting thing is that CF's XPath behaves like a cursor in the XML object - in the example above, you could search x for / and get the whole document again. Hope thats mildly interesting Kam ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189035 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 and RDF XML
cfset newsitems= XmlSearch(newsobj, //item) Paul: Try this instead... cfset newsitems = XmlSearch(newsobj, //*[name()='item']) -- Roger Benningfield work: http://journurl.com/ blog: http://admin.mxblogspace.journurl.com/ ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183590 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 and RDF XML
I'm trying to get all of the item elements in the XML doc pasted below using the following Xpath query but the returned array is empty. Namespaces without prefixes can be tricky to handle with XPath 1.0... This should do the job: cfset newsitems= XmlSearch(newsobj, //*[local-name()='item']) Massimo Foti DW tools: http://www.massimocorner.com CF tools: http://www.olimpo.ch/tmt/ ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183597 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 and RDF XML
Excellent thanks! -Original Message- From: Roger Benningfield [mailto:[EMAIL PROTECTED] Sent: Monday, 8 November 2004 18:32 To: CF-Talk Subject: Re: XPATH and RDF XML cfset newsitems= XmlSearch(newsobj, //item) Paul: Try this instead... cfset newsitems = XmlSearch(newsobj, //*[name()='item']) -- Roger Benningfield work: http://journurl.com/ blog: http://admin.mxblogspace.journurl.com/ ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183674 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
XPATH and RDF XML
I'm trying to get all of the item elements in the XML doc pasted below using the following Xpath query but the returned array is empty. cffile action=READ file=c:\inetpub\wwwroot\pp\test.xml variable=news cfset XMLobj=XMLParse(news) cfset newsobj=XMLobj.rdf cfset newsitems= XmlSearch(newsobj, item) cfdump var=#newsitems# Surley this Xpath statement should get all the item elements as well?? cfset newsitems= XmlSearch(newsobj, //item) rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#; xmlns=http://purl.org/rss/1.0/; channel rdf:about=http://www.xml.com/xml/news.rss; titleXML.com/title linkhttp://xml.com/pub/link description XML.com features a rich mix of information and services for the XML community. /description image rdf:resource=http://xml.com/universal/images/xml_tiny.gif; / items rdf:Seq rdf:li resource=http://xml.com/pub/2000/08/09/xslt/xslt.html; / rdf:li resource=http://xml.com/pub/2000/08/09/rdfdb/index.html; / /rdf:Seq /items /channel image rdf:about=http://xml.com/universal/images/xml_tiny.gif; titleXML.com/title linkhttp://www.xml.com/link urlhttp://xml.com/universal/images/xml_tiny.gif/url /image item rdf:about=http://xml.com/pub/2000/08/09/xslt/xslt.html; titleProcessing Inclusions with XSLT/title linkhttp://xml.com/pub/2000/08/09/xslt/xslt.html/link description Processing document inclusions with general XML tools can be problematic. This article proposes a way of preserving inclusion information through SAX-based processing. /description /item item rdf:about=http://xml.com/pub/2000/08/09/rdfdb/index.html; titlePutting RDF to Work/title linkhttp://xml.com/pub/2000/08/09/rdfdb/index.html/link description Tool and API support for the Resource Description Framework is slowly coming of age. Edd Dumbill takes a look at RDFDB, one of the most exciting new RDF toolkits. /description /item /rdf:RDF Can any help me on this? Thanks ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183586 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: Xmlsearch Xpath
You might find this handy then: http://www.cfdev.com/xml/xpath/ Adam Haskell wrote: A little while ago someone, sorry I forget who, had asked about sharing links to good Xpath tutorials on the web related to coldfusion, the question basically went unanswered. I started looking around and noticed there weren't any that I could find. So I set out to change that and started digging around Xpath tutorials and reading W3C's specs, a few days later I have what might actually be the semblance of a tutorial. Before I release it to the masses, and get pummeled with critique, I was hoping I could get a few brave volunteers to read it over and give me some feedback as to what I could change/include. Any takers? Adam H [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Re: Xmlsearch Xpath
Yeah been there thats about the only thing I found anywhere :( Adam On Fri, 20 Aug 2004 11:53:08 -0400, Pete Freitag [EMAIL PROTECTED] wrote: You might find this handy then: http://www.cfdev.com/xml/xpath/ Adam Haskell wrote: A little while ago someone, sorry I forget who, had asked about sharing links to good Xpath tutorials on the web related to coldfusion, the question basically went unanswered. I started looking around and noticed there weren't any that I could find. So I set out to change that and started digging around Xpath tutorials and reading W3C's specs, a few days later I have what might actually be the semblance of a tutorial. Before I release it to the masses, and get pummeled with critique, I was hoping I could get a few brave volunteers to read it over and give me some feedback as to what I could change/include. Any takers? Adam H [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Xmlsearch Xpath
A little while ago someone, sorry I forget who, had asked about sharing links to good Xpath tutorials on the web related to coldfusion, the question basically went unanswered. I started looking around and noticed there weren't any that I could find. So I set out to change that and started digging around Xpath tutorials and reading W3C's specs, a few days later I have what might actually be the semblance of a tutorial. Before I release it to the masses, and get pummeled with critique, I was hoping I could get a few brave volunteers to read it over and give me some feedback as to what I could change/include. Any takers? Adam H [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
Strange XML/XPath behavior
Greetings, I'm seeing strange behavior when working with XML files that concerns me a bit and I was hoping someone could help explain what was going on here.I have a simple XML file: ?xml version=1.0 encoding=iso-8859-1? authors author name idd=VHVictor Hugo/name nationalityFrench/nationality /author author period=classical nameSophocles/name nationalityGreek/nationality /author author nameLeo Tolstoy/name nationalityRussian/nationality /author author nameAlexander Pushkin/name nationalityRussian/nationality /author author period=classical namePlato/name nationalityGreek/nationality /author /authors I'm trying to fetch an element using XPath and then delete that element from the XML Object.The code below works, but I don't think it should.Here's the code: cffile action=""> file=#GetDirectoryFromPath(GetBaseTemplatePath())#simple.xml variable=strXmlDoc cftry cfset objRSS = XmlParse( strXmlDoc ) cfcatch type=any Error: Malformed XML document cfabort /cfcatch /cftry cfif IsDefined( objRSS ) cfset temp = XmlSearch( objRSS, /authors/author [nationality='Russian'] ) cfdump var=#temp# cfset ArrayDeleteAt( temp[1], 1 ) cfdump var=#temp# cfdump var=#objRSS# /cfif My concern is with the ArrayDeleteAt() function.The above works, but it seems a bit odd.Even stranger is that if I change the line to this: cfset ArrayDeleteAt( temp[1][1], 1 ) it still works.Furthermore, if I change the line to this: cfset ArrayDeleteAt( temp[1][1][1][1][1][1][1][1][1][1][1][1], 1 ) it STILL works.Can anyone explain what is going on here?Thanks!! Ryan Hagan ph: 540-731-3588 [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
XPath Help
Hi, I'm trying to get some XPath to work with respect to a navigation tree. ?xml version=1.0 encoding=utf-8 ? tree node objectid=3456 title=Informationa node objectid=2134 title=Contact / node objectid=5656 title=Top 1.2 / node objectid=5672 title=Top 1.3 / node objectid=123 title=Top 1.4 / node objectid=8357 title=Top 1.5 / /node node objectid=9834 title=Banks circuit=banks / node objectid=2245 title=Corporates circuit=corporates node objectid=45688 title=Top 3.1 / node objectid=9567 title=Top 3.2 / node objectid=4633 title=Top 3.3 / /node node objectid=1554 title=Managers / node objectid=6734 title=Library / /tree I can use Xpath to return all the child nodes within a node using //[EMAIL PROTECTED]3] However, how can I do this in reverse?How can I retrieve the node that is the parent of a particular node?How can I get the objectid of the parent of 2134? Any help you could share would be great! Thanks Tony [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]
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
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. ?xml version=1.0 encoding=utf-8 ? tree node objectid=3456 title=Informationa node objectid=2134 title=Contact / node objectid=5656 title=Top 1.2 / node objectid=5672 title=Top 1.3 / node objectid=123 title=Top 1.4 / node objectid=8357 title=Top 1.5 / /node node objectid=9834 title=Banks circuit=banks / node objectid=2245 title=Corporates circuit=corporates node objectid=45688 title=Top 3.1 / node objectid=9567 title=Top 3.2 / node objectid=4633 title=Top 3.3 / /node node objectid=1554 title=Managers / node objectid=6734 title=Library / /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]
XMLSearch Xpath Question
OK so I have been able to use XMLSearch filter by attributes, however I want to be able to filter by the actual text between tags...the funny thing is all of my CFMX books only filter by attributes in their examples. I know this has to be really easy, but I am not sure how to write an XPath statement to filter by the text between tags...For example in the XML document below I want to just be able to pull those courses with FS between the subject tags, this is what I thought would work but it gives me nice little empy array. Thank you in advance My Xpath statement: resultsXML=XMLSearch(IDcoursesXML, '/catalog/course[subject=FS]') A snippet of the XML I am trying to search/filter: --- ?xml version=1.0? catalog course section DS-202/section subject DS/subject title ![CDATA[ Intro Disability Studies ]] /title description ![CDATA[ This course will explore the social, cultural, and ethical issues surrounding the experience of disability. It is co-taught by faculty from the English Department and the School of Physical Therapy. Prerequisite: sophomore standing. 2 hours. Thompson, Cicirello, Medeiros. ]] /description credithours ![CDATA[2.00 ]] /credithours /course course section DS-400/section subjectDS/subject title ![CDATA[ Disability Studies in Theory Practice ]] /title description ![CDATA[ This course, a capstone for students in the Disability Studies minor, is a combination of seminar and field work. (The field work may be in the form on internships or service-learning.) In this course, students will review major concepts covered in prior Disability Studies classes. This review will be conducted in light of experiences and knowledge acquired working at appropriate sites in the local community. 2 hours. Thompson, Cicirello, Medeiros. ]] /description credithours ![CDATA[2.00 ]]/credithours /course course section FS-150/section subjectFS/subject title ![CDATA[ Personal Self Defense Women]] /title description ![CDATA[ Women's Self Defense. See Human Performance department for course description. 1 hour. Staff. ]] /description credithours ![CDATA[ 1.00 ]] /credithours /course --- [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: XMLSearch Xpath Question
This should work: /catalog/course/subject[text()='DS'] Even better, you could trim the text before comparing it: /catalog/course/subject[normalize-space(text())='DS'] You can find an excellent tutorial here: http://www.w3schools.com/xpath/default.asp A great book: http://www.oreilly.com/catalog/xpathpointer Handy tools for testing XPath expressions: http://www.purpletech.com/xpe/index.jsp http://www.topxml.com/xpathvisualizer/ Hope it will help Massimo Foti http://www.massimocorner.com Co-Author of Dreamweaver MX 2004 Magic: http://www.dwmagic.com/ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Xpath expressions compliance
Anybody know if Xpath in CF is fully compliant with all functions, expressions,etc... Of the spec? I tried to use the value() function and got a not defined error. Its certainly possible I implemented wrong, but I know how CF likes to do partial implementations every so often ;) Thanks Kevin -Kevin Marino -- Webmaster - HealthObjects [EMAIL PROTECTED] [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Xpath expressions compliance
Anybody know if Xpath in CF is fully compliant with all functions, expressions,etc... Of the spec? I tried to use the value() function and got a not defined error. Its certainly possible I implemented wrong, but I know how CF likes to do partial implementations every so often ;) The problem is that XmlSearch() works only with XPath expressions that returns an array of XML elelemts (NodeList). Anything else will throw an exception. See the first comment here: http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/funca126.htm#wp427963 6 Massimo Foti http://www.massimocorner.com Co-Author of Dreamweaver MX 2004 Magic: http://www.dwmagic.com/ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: Xpath expressions compliance
On Tue, 2004-02-10 at 07:50, Massimo Foti wrote: Anybody know if Xpath in CF is fully compliant with all functions, expressions,etc... Of the spec? I tried to use the value() function and got a not defined error. Its certainly possible I implemented wrong, but I know how CF likes to do partial implementations every so often ;) The problem is that XmlSearch() works only with XPath expressions that returns an array of XML elelemts (NodeList). Anything else will throw an exception. side_note If you use XmlTransform and cfsavecontent to do xml searches, however, is uses Xerces so that is fully compatible with the same Xpath version as Xerces XSLT (Xpath 1.0 I think).I would assume (as most coders hate to write the same thing twice) that the XmlSearch is using the same sort of process with a bit of MM intervention. /side_note -- Vale, Rob Luxuria immodica insaniam creat. Sanam formam viatae conservate! http://www.rohanclan.com http://treebeard.sourceforge.net http://ashpool.sourceforge.net [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: Xpath expressions compliance
Thanks Massimo, That helps a lot. Seems a typical CF implementation of technology, so guess next version will be fully compliant, ;-). Either that or they rather us write it via Java. Rob, Good point. Might have to give that a try see what happens. Thanks -Kevin Marino -- Webmaster - HealthObjects [EMAIL PROTECTED] -Original Message- From: Rob Rohan [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 11:30 AM To: CF-Talk Subject: Re: Xpath expressions compliance On Tue, 2004-02-10 at 07:50, Massimo Foti wrote: Anybody know if Xpath in CF is fully compliant with all functions, expressions,etc... Of the spec? I tried to use the value() function and got a not defined error. Its certainly possible I implemented wrong, but I know how CF likes to do partial implementations every so often ;) The problem is that XmlSearch() works only with XPath expressions that returns an array of XML elelemts (NodeList). Anything else will throw an exception. side_note If you use XmlTransform and cfsavecontent to do xml searches, however, is uses Xerces so that is fully compatible with the same Xpath version as Xerces XSLT (Xpath 1.0 I think).I would assume (as most coders hate to write the same thing twice) that the XmlSearch is using the same sort of process with a bit of MM intervention. /side_note -- Vale, Rob Luxuria immodica insaniam creat. Sanam formam viatae conservate! http://www.rohanclan.com http://www.rohanclan.com http://treebeard.sourceforge.net http://treebeard.sourceforge.net http://ashpool.sourceforge.net http://ashpool.sourceforge.net _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
XPath expr to get all attributes....how?
I have a XML file that looks like this (actually fusebox.xml file from FB4, for those who are familiar) circuit fuseaction name=somename .. /fuseaction . . /circuit I need to get a list of all the attribute values for name into an array. Right now, I'm using the xpath _expression_ /circuit/[EMAIL PROTECTED], to first get an array of all fuseaction structures, and then doing myarray[idx].XmlAttributes.name to get the attribute values. Is there a better XPath _expression_ to get just the attribute values. All the examples I see relate to searching sub-elements on the attribute value, but not related to getting the attributes themselves. TIA, Nikhil [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: XPath expr to get all attributes....how?
I don't know of another way currently other than creating a string variable in XSL and looping in XSL and appending each attribute name value to the string comma delimited and then running listToArray on that string. The way your doing it is fine. You may also want to see if this site has an answer. http://www.dpawson.co.uk/xsl/sect2/sect21.html -Original Message- From: Nikhil Madani [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 1:39 PM To: CF-Talk Subject: XPath expr to get all attributeshow? I have a XML file that looks like this (actually fusebox.xml file from FB4, for those who are familiar) circuit fuseaction name=somename .. /fuseaction . . /circuit I need to get a list of all the attribute values for name into an array. Right now, I'm using the xpath _expression_ /circuit/[EMAIL PROTECTED], to first get an array of all fuseaction structures, and then doing myarray[idx].XmlAttributes.name to get the attribute values. Is there a better XPath _expression_ to get just the attribute values. All the examples I see relate to searching sub-elements on the attribute value, but not related to getting the attributes themselves. TIA, Nikhil [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: XPath expr to get all attributes....how?
The CFMX implementation only supports returning an array of elements, not attributes. Sam --- Blog: http://www.rewindlife.com Charts: http://www.blinex.com/products/charting --- -Original Message- From: Nikhil Madani [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 1:39 PM To: CF-Talk Subject: XPath expr to get all attributeshow? I have a XML file that looks like this (actually fusebox.xml file from FB4, for those who are familiar) circuit fuseaction name=somename .. /fuseaction . . /circuit I need to get a list of all the attribute values for name into an array. Right now, I'm using the xpath _expression_ /circuit/[EMAIL PROTECTED], to first get an array of all fuseaction structures, and then doing myarray[idx].XmlAttributes.name to get the attribute values. Is there a better XPath _expression_ to get just the attribute values. All the examples I see relate to searching sub-elements on the attribute value, but not related to getting the attributes themselves. TIA, Nikhil [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Tricky XML/XPath Question!
Here's an XML samplefile: addresses address city=New York / address city=Tampa / address city=Bethesda / /addresses Using the following Xpath and instruction: Xpath: /addresses/address[2] Instruction: Insert a new address element before (as a preceding-sibling) the element selected with the above Xpath. In this case, it would read Insert a new address element between the 'Tampa' and 'Bethesda' address elements. The Problem: The problem here is that using XMLSearch() with the supplied XPath will return the address city=Tampa / without reference to any of the other sibling address elements. What would you do to address this? So far, I have an idea, but it seems too hackish: 1) Cache the index of the last location step in the xpath (in this case, 2). 2) Remove the last location step of the Xpath, XMLSearch() again to return address[2]'s parent (with siblings now in XmlChildren) 3) Add 1 to the cached index (2+1=3). 4) Create the new address element with XMLElemNew() 5) Use ArrayInsertAt() to add the element to the parent.XMLChildren array, using 3 as the insert point. Anyone see an easier way, perhaps by using the XMLChildPos() function? Thanks in advance! -- Alex Sherwood PHS Collection Agency THE COLLECTORS T:301.215.4200 F:301.664.6834 W: www.phs-net.com [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: XML/XPATH
The closet I've gotten is this. cfset newXML = XmlSearch(masterXML,/root/article[type = 'Event']). But, this returns an Array of XML structures, when what I really want is a single XML structure. newXML[1]= article typeEvent/type /article newXML[2]= article typeEvent/type /article What relatively basic concept am I not getting here? Executing an XPath expression on a XML structure with XmlSearch always return the CFML equivalent of a DOM NodeList. The NodeList may be empty or contain only one node but it's still a NodeList, so in CFML you get an array of XML elements. Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ~| Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com
XML/XPATH
Ok, I'm trying to get my head around this XML stuff. I've got a document/structure something like this. root article typeNews/type /article article typeEvent/type /article article typeNews/type /article article typeEvent/type /article article typeHeadline/type /article /root What would I want to do (in ColdFusion at this time) is parse this structure and return a subset structure such as below! In other words, I want to return a structure only containing type nodes of a certain value. I have tied every way I could think of to use xmlsearch() and an xpath string to get this, but can't seem to quite get it right. root article typeEvent/type /article article typeEvent/type /article /root The closet I've gotten is this. cfset newXML = XmlSearch(masterXML,/root/article[type = 'Event']). But, this returns an Array of XML structures, when what I really want is a single XML structure. newXML[1]= article typeEvent/type /article newXML[2]= article typeEvent/type /article What relatively basic concept am I not getting here? -- Ian Skinner Web Programmer BloodSource Sacramento, CA ~| Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
RE: XML/XPATH
Is there a way to get a single, modified XML document/structure? -- Ian Skinner Web Programmer BloodSource Sacramento, CA -Original Message- From: Massimo Foti [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 8:48 AM To: CF-Talk Subject: Re: XML/XPATH The closet I've gotten is this. cfset newXML = XmlSearch(masterXML,/root/article[type = 'Event']). But, this returns an Array of XML structures, when what I really want is a single XML structure. newXML[1]= article typeEvent/type /article newXML[2]= article typeEvent/type /article What relatively basic concept am I not getting here? Executing an XPath expression on a XML structure with XmlSearch always return the CFML equivalent of a DOM NodeList. The NodeList may be empty or contain only one node but it's still a NodeList, so in CFML you get an array of XML elements. Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ~| Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
Re: XML/XPATH
Ian Skinner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there a way to get a single, modified XML document/structure? You have many options, the easier should be: 1) XSLT 2) Serialize the node in the NodeList and build a new XML document from there Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ~| Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Get the mailserver that powers this list at http://www.coolfusion.com
ot- visual Xpath Navigator
does anyone know of a visual xpath navigator? or if there is one in the works... tony weeg uncertified advanced cold fusion developer tony at navtrak dot net www.navtrak.net office 410.548.2337 fax 410.860.2337 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: ot- visual Xpath Navigator
Tony Weeg [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] does anyone know of a visual xpath navigator? or if there is one in the works... I am not sure what you are looking for, but I've fund this tool very handy for visually testing XPath expressions: http://www.topxml.com/xpathvisualizer/ Hope it may help -- Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: ot- visual Xpath Navigator
Tony Weeg [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] does anyone know of a visual xpath navigator? or if there is one in the works... I am not sure what you are looking for, but I've fund this tool very handy for visually testing XPath expressions: http://www.topxml.com/xpathvisualizer/ Hope it may help -- Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: ot- visual Xpath Navigator
thanks. I have developer here who is working with that xml stuff, and was wondering if my community as he calls it ... had any ideas ... thanks massimo! tony weeg uncertified advanced cold fusion developer tony at navtrak dot net www.navtrak.net office 410.548.2337 fax 410.860.2337 -Original Message- From: Massimo Foti (on holiday) [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 10:46 AM To: CF-Talk Subject: Re: ot- visual Xpath Navigator Tony Weeg [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] does anyone know of a visual xpath navigator? or if there is one in the works... I am not sure what you are looking for, but I've fund this tool very handy for visually testing XPath expressions: http://www.topxml.com/xpathvisualizer/ Hope it may help -- Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: ot- visual Xpath Navigator
xmlspy does this as well. Probably my favorite feature. -- jon mailto:[EMAIL PROTECTED] Wednesday, July 16, 2003, 11:44:06 AM, you wrote: TW thanks. TW I have developer here who is working with that xml stuff, and was TW wondering if my community as he calls it ... had any ideas ... thanks TW massimo! TW tony weeg TW uncertified advanced cold fusion developer TW tony at navtrak dot net TW www.navtrak.net TW office 410.548.2337 TW fax 410.860.2337 TW -Original Message- TW From: Massimo Foti (on holiday) [mailto:[EMAIL PROTECTED] TW Sent: Wednesday, July 16, 2003 10:46 AM TW To: CF-Talk TW Subject: Re: ot- visual Xpath Navigator TW Tony Weeg [EMAIL PROTECTED] wrote in message TW news:[EMAIL PROTECTED] does anyone know of a visual xpath navigator? or if there is one in the works... TW I am not sure what you are looking for, but I've fund this tool very TW handy for visually testing XPath expressions: TW http://www.topxml.com/xpathvisualizer/ TW Hope it may help TW -- TW TW Massimo Foti TW Certified Dreamweaver MX Developer TW Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ TW TW ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: ot- visual Xpath Navigator
does anyone know of a visual xpath navigator? It's not exactly a navigator, but it's pretty neat and useful, I think: http://www.vbxml.com/xpathvisualizer/ Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: xml XPath Equivalent in CF Notation
The is getting a little weird.. xmlFirstSearch = xmlSearch(odoc, Books/[EMAIL PROTECTED]'Reference Book']); Now i want to search the Result of the the First Search.. xmlSecondSearch = xmlSearch(xmlFirstSearch, Book/Author']); The above doesnt seem to work.. because xmlFirstSearch is NOT a valid XML DOC... Is there work around this Other than Searching the Orginal DOC again. xmlSecondSearch = xmlSearch(odoc Book/[EMAIL PROTECTED]'Reference Book']/Author); Thanks, Joe Eugene - Original Message - From: Sean A Corfield [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, June 24, 2003 11:38 PM Subject: Re: xml XPath Equivalent in CF Notation On Tuesday, Jun 24, 2003, at 20:04 US/Pacific, Joe Eugene wrote: Cant figure this one out OR is it possible in CF xml Notation. XML.. Books Book type=Reference Book TitleJava Programming/Title AuthorIvor Horton/Author AuthorIvor Horton/Author /Book /Books Here is what i want to return using XPath...All the Author for node Element Book cfdump var=#xmlSearch(odoc, Books/Book[1]/Author)# What is the CF Equivalent to the above in CFMX Notation odoc.xmlRoot.Book[1]...? You can get to the elements of Book but that will be an array (I think) and you'll have to manually iterate through each element to see whether it is Author or not. Sean A Corfield -- http://www.corfield.org/blog/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4