[Lucee] Re: Migration CF10 To Lucee

Hi Dominique,

What result are you expecting or trying to extract? If you let me know I
will take a look at it.

All the best,

MartinOn 12 November 2015 at 22:36, Dominique Dupuis <@Dominique_Dupuis> wrote:

I have this regex code that used to work in CF10 but since moving to
Lucee, it no longer works. (The problem is not Lucee, it is the Regex, and
Lucee just seems to be less forgiving…)
The code is:
<cfset ThisNode =
#XMLSearch(xmlResponse,"//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘#CanPost_ServiceRegion##xmldata.CanPost_service_code#’
]/count(preceding-sibling::) + 1")#>
The variable in the middle could be USA.SP.AIR for the purpuse of testing:
so
<cfset ThisNode =
#XMLSearch(xmlResponse,"//
[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[
= ‘USA.SP.AIR’ ]/count(preceding-sibling::*) + 1")#>

All the tests site that I’ve tried tell me the above is wrong, but I could
not fine one that explains what is wrong.

Can someone point me in the right direction?

The test xml file could be:

<?xml version="1.0" encoding="UTF_8"?> http://www.canadapost.ca/ws/ship/rate_v2"><price_quote><service_code>USA.EP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.EP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Expedited
Parcel
USA</service_name><price_details>19.400.000.000.0020.22<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.82</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>4</expected_transit_time><expected_delivery_date>2015_11_19</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.PW.PAK</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PAK?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide pak
USA</service_name><price_details>63.320.000.000.0065.06<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.74</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.PW.PARCEL</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PARCEL?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide parcel
USA</service_name><price_details>70.300.000.000.0072.23<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.93</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.SP.AIR</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.SP.AIR?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Small
Packet USA
Air</service_name><price_details>16.230.000.000.0016.23</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>
USA.TP</service_code><service_link rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.TP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Tracked
Packet _
USA</service_name><price_details>18.190.000.000.0018.96<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.77</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>6</expected_transit_time><expected_delivery_date>2015_11_23</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.XP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.XP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Xpresspost
USA</service_name><price_details>30.600.000.000.0033.43<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>2.83</adjustment_cost>9.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>true</guaranteed_delivery><expected_transit_time>3</expected_transit_time><expected_delivery_date>2015_11_18</expected_delivery_date></service_standard></price_quote></price_quotes>

I tried to add the

On Thursday, October 1, 2015 at 4:18:13 PM UTC-4, Dominique Dupuis wrote:

To keep things separate, I’ve mark a star on the posted solution
that worked, and created a new topic for the next problem I was facing.
(the Binary pdf problem). Dominique

On Thursday, September 24, 2015 at 1:21:49 PM UTC-4, Dominique Dupuis wrote:

Good, I can use these for further testing.

Moving on to next migration problem… I was testing this particular
line of code, that retreives the url of the actual label because I was told
both that Lucee handles PDF raw and that it did not handle it…
So I needed to fiind out if this was an issue:
A dump of the respond from Canada post API (cfhttp.FileContent) looks
like this (but shorten quite a lot):
Native Array (byte)Raw[60,63,120,115,99,1(…lots more
numbers…)15,97,103,101,115,62]
Base64 EncodedPD94(…lots more
whatever…)wIiBl]

On CF10-11 I used this: to show my shipping label so I can print
it.

On Lucee, this results in the browser telling me that “This PDF doc
might not be displayed correctly”… and it does not display at all. The
browser offers to try opening it with different viewers but the result is
the same when I do. They don’t read it as being a pdf file. This tells me
either Lucee can’t use pdf as type for the tag cfcontent, or the
conversion of raw fails. The wed site:
http://docs.lucee.org/reference/tags/content.html does not even
specify any accepted type! So I’m left in the dark as to what is wrong.
Thank you
Dominique

On Thursday, September 24, 2015 at 12:08:37 PM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

Glad it worked for you.

I would guess it may be down to whatever XML parser is being used
within the Whitebeam Xpath Testbed. It works OK using these ones:
http://www.xpathtester.com/xpath
http://codebeautify.org/Xpath-Tester
http://www.utilities-online.info/xpath

All the best,

Martin

On Thursday, September 24, 2015 at 4:50:05 PM UTC+1, Dominique Dupuis wrote:

Hi Martin,
You’re my new best friend!!
It works like a charm, almost everywhere, CF10, CF11 and Lucee. But
it does not work on the XPath Expression testbed site?!? This is not a big
deal, except for the fact that I still don’t know why it works so
differently (or not) from one place to the other.

For now, I will use your solution since it works in both target
environments. Now I’m still missing some understanding as to why it works.
I need just enough so I can track and fix potential problems in the many
more lines of codes that use XPath in this shipping module.
You say you use it to avoid having to deal with the namespaces
prefixes, but my limited understanding of XPath was that this was what
(this wild card) *: was suppose to do.

Thank you for your help!
Dominique

On Thursday, September 24, 2015 at 6:26:56 AM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

I have just tried the following XPath against your XML and it looks
to work OK in Lucee 4.5.1.022:

normalize-space(string(//*[local-name()=‘link’][@rel=‘label’]/@href))

I have used local-name() in the pas to avoid having to deal with the
namespaces prefixes.

All the best,

Martin

On Wednesday, September 23, 2015 at 9:02:26 PM UTC+1, Dominique Dupuis wrote:

To answer Tom, In this case, I’m trying to extract only the *href *of
the label. (notice there are other href in the same xml doc).
As suggested by Lutz, I tried adding changing ‘label’ for ““label””
without luck.

Further info: What i’m actually doing is converting an Carweaver
based online store, presently hosted on cf10 server and using a MSSQL
database, to a Lucee hosted server using MySQL database.
Cartweaver was already pretty much compatatible with Lucee. The
database conversion also was relatively easy. Now I’m left with ironing out
problems with my own customization codes. In this case, it is the shipping
module.
It makes extensive use of xmlsearch! And it is a long code! (with
various API connections for both UPS and Canada Post) So I need to not
just fix this particular one, but I need to understand what is going on so
I can find and correct the rest of this module.

What puzzles me is that CF gets the proper link using (//*:link[@rel
= ‘label’]/@href) while neither Lucee nor the web site (online xmlsearch
test site) returns a link with that. This could be the “cf being forgiving”
factor. But the online test web site does return the proper link with
…//:link… (Just removing the *) and Lucee still returns empty with
everything! //link, //link and even with /descendant::link could the
problem be with the prefix string in <cfset GetArtifactURL =
Replace(XmlSearch(Trim(xmlResponse),"normalize-space(string(//
:link[@rel
= ‘label’]/@href))"),"_","-",“all”)>

On Wednesday, September 23, 2015 at 10:49:26 AM UTC-4, lu...@lesener.de wrote:

On Tuesday, 22 September 2015 18:26:32 UTC+2, Dominique Dupuis wrote:

<cfset GetArtifactURL =
Replace(XmlSearch(Trim(xmlResponse),“normalize-space(string(//*:link[@rel =
‘label’]/@href))”),"_","-",“all”)>

Just a shot in the dark: What happens if you replace ‘label’ with
““label”” ?

rgds
Lutz


Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html


You received this message because you are subscribed to a topic in the
Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com

I was doing my testing on http://codebeautify.org/Xpath-Tester wich was
one of the ones you recommended a few days ago. And it gives me an
error?!?
SyntaxError: The string
‘//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’] [* =
‘USA.XP’ ]/count(preceding-sibling–*) + 1’ is not a valid XPath expression.On Friday, November 13, 2015 at 10:51:32 AM UTC-5, Dominique Dupuis wrote:

Hi Martin, Another way to put my question would be this: All I know when
I start my search is the data in one of the service_code nodes (for example
USA.TP). From that info, I need to figure out the position of the parent
node price_quote amongst the other price_quote in the grandparent node
price_quotes (so for USA.TP we want to return : 5 or USA.EP :1 etc).
This way, later in my code I can reference various notes using the
specific [1] (numbered positions) And thank you in advance, Seriously, I’ve
spent 3 hours on this yesterday, and I still could not figure what is
wrong!

I do know that this part works: //[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘USA.XP’ ]
which means that /count(preceding-sibling::*) + 1 does not work.
But you cannot image the number of variations I did with it, with no
success! So again, thankyou!

Dominique

On Friday, November 13, 2015 at 4:26:01 AM UTC-5, Martin Webb wrote:

Hi Dominique,

What result are you expecting or trying to extract? If you let me know I
will take a look at it.

All the best,

Martin

On 12 November 2015 at 22:36, Dominique Dupuis domini...@gmail.com wrote:

I have this regex code that used to work in CF10 but since moving to
Lucee, it no longer works. (The problem is not Lucee, it is the Regex, and
Lucee just seems to be less forgiving…)
The code is:
<cfset ThisNode =
#XMLSearch(xmlResponse,"//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘#CanPost_ServiceRegion##xmldata.CanPost_service_code#’
]/count(preceding-sibling::) + 1")#>
The variable in the middle could be USA.SP.AIR for the purpuse of
testing: so
<cfset ThisNode =
#XMLSearch(xmlResponse,"//
[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[
= ‘USA.SP.AIR’ ]/count(preceding-sibling::*) + 1")#>

All the tests site that I’ve tried tell me the above is wrong, but I
could not fine one that explains what is wrong.

Can someone point me in the right direction?

The test xml file could be:

<?xml version="1.0" encoding="UTF_8"?> http://www.canadapost.ca/ws/ship/rate_v2"><price_quote><service_code>USA.EP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.EP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Expedited
Parcel
USA</service_name><price_details>19.400.000.000.0020.22<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.82</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>4</expected_transit_time><expected_delivery_date>2015_11_19</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.PW.PAK</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PAK?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide pak
USA</service_name><price_details>63.320.000.000.0065.06<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.74</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.PW.PARCEL</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PARCEL?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide parcel
USA</service_name><price_details>70.300.000.000.0072.23<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.93</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.SP.AIR</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.SP.AIR?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Small
Packet USA
Air</service_name><price_details>16.230.000.000.0016.23</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>
USA.TP</service_code><service_link rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.TP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Tracked
Packet _
USA</service_name><price_details>18.190.000.000.0018.96<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.77</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>6</expected_transit_time><expected_delivery_date>2015_11_23</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.XP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.XP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Xpresspost
USA</service_name><price_details>30.600.000.000.0033.43<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>2.83</adjustment_cost>9.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>true</guaranteed_delivery><expected_transit_time>3</expected_transit_time><expected_delivery_date>2015_11_18</expected_delivery_date></service_standard></price_quote></price_quotes>

I tried to add the

On Thursday, October 1, 2015 at 4:18:13 PM UTC-4, Dominique Dupuis wrote:

To keep things separate, I’ve mark a star on the posted solution
that worked, and created a new topic for the next problem I was facing.
(the Binary pdf problem). Dominique

On Thursday, September 24, 2015 at 1:21:49 PM UTC-4, Dominique Dupuis wrote:

Good, I can use these for further testing.

Moving on to next migration problem… I was testing this particular
line of code, that retreives the url of the actual label because I was told
both that Lucee handles PDF raw and that it did not handle it…
So I needed to fiind out if this was an issue:
A dump of the respond from Canada post API (cfhttp.FileContent) looks
like this (but shorten quite a lot):
Native Array (byte)Raw[60,63,120,115,99,1(…lots more
numbers…)15,97,103,101,115,62]
Base64 EncodedPD94(…lots more
whatever…)wIiBl]

On CF10-11 I used this: to show my shipping label so I can print
it.

On Lucee, this results in the browser telling me that “This PDF doc
might not be displayed correctly”… and it does not display at all. The
browser offers to try opening it with different viewers but the result is
the same when I do. They don’t read it as being a pdf file. This tells me
either Lucee can’t use pdf as type for the tag cfcontent, or the
conversion of raw fails. The wed site:
http://docs.lucee.org/reference/tags/content.html does not even
specify any accepted type! So I’m left in the dark as to what is wrong.
Thank you
Dominique

On Thursday, September 24, 2015 at 12:08:37 PM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

Glad it worked for you.

I would guess it may be down to whatever XML parser is being used
within the Whitebeam Xpath Testbed. It works OK using these ones:
http://www.xpathtester.com/xpath
http://codebeautify.org/Xpath-Tester
http://www.utilities-online.info/xpath

All the best,

Martin

On Thursday, September 24, 2015 at 4:50:05 PM UTC+1, Dominique Dupuis wrote:

Hi Martin,
You’re my new best friend!!
It works like a charm, almost everywhere, CF10, CF11 and Lucee. But
it does not work on the XPath Expression testbed site?!? This is not a big
deal, except for the fact that I still don’t know why it works so
differently (or not) from one place to the other.

For now, I will use your solution since it works in both target
environments. Now I’m still missing some understanding as to why it works.
I need just enough so I can track and fix potential problems in the many
more lines of codes that use XPath in this shipping module.
You say you use it to avoid having to deal with the namespaces
prefixes, but my limited understanding of XPath was that this was what
(this wild card) *: was suppose to do.

Thank you for your help!
Dominique

On Thursday, September 24, 2015 at 6:26:56 AM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

I have just tried the following XPath against your XML and it looks
to work OK in Lucee 4.5.1.022:

normalize-space(string(//*[local-name()=‘link’][@rel=‘label’]/@href))

I have used local-name() in the pas to avoid having to deal with
the namespaces prefixes.

All the best,

Martin

On Wednesday, September 23, 2015 at 9:02:26 PM UTC+1, Dominique Dupuis wrote:

To answer Tom, In this case, I’m trying to extract only the *href
*of the label. (notice there are other href in the same xml
doc).
As suggested by Lutz, I tried adding changing ‘label’ for
““label”” without luck.

Further info: What i’m actually doing is converting an Carweaver
based online store, presently hosted on cf10 server and using a MSSQL
database, to a Lucee hosted server using MySQL database.
Cartweaver was already pretty much compatatible with Lucee. The
database conversion also was relatively easy. Now I’m left with ironing out
problems with my own customization codes. In this case, it is the shipping
module.
It makes extensive use of xmlsearch! And it is a long code! (with
various API connections for both UPS and Canada Post) So I need to not
just fix this particular one, but I need to understand what is going on so
I can find and correct the rest of this module.

What puzzles me is that CF gets the proper link
using (//*:link[@rel = ‘label’]/@href) while neither Lucee nor the web site
(online xmlsearch test site) returns a link with that. This could be the
“cf being forgiving” factor. But the online test web site does return the
proper link with …//:link… (Just removing the *) and Lucee still
returns empty with everything! //link, //link and even with
/descendant::link could the problem be with the prefix string in <cfset
GetArtifactURL = Replace(XmlSearch(Trim(
xmlResponse),"normalize-space(string(//
:link[@rel =
‘label’]/@href))"),"_","-",“all”)>

On Wednesday, September 23, 2015 at 10:49:26 AM UTC-4, lu...@lesener.de wrote:

On Tuesday, 22 September 2015 18:26:32 UTC+2, Dominique Dupuis wrote:

<cfset GetArtifactURL =
Replace(XmlSearch(Trim(xmlResponse),“normalize-space(string(//*:link[@rel =
‘label’]/@href))”),"_","-",“all”)>

Just a shot in the dark: What happens if you replace ‘label’ with
““label”” ?

rgds
Lutz


Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html


You received this message because you are subscribed to a topic in the
Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com

Hi Martin, Another way to put my question would be this: All I know when I
start my search is the data in one of the service_code nodes (for example
USA.TP). From that info, I need to figure out the position of the parent
node price_quote amongst the other price_quote in the grandparent node
price_quotes (so for USA.TP we want to return : 5 or USA.EP :1 etc). This
way, later in my code I can reference various notes using the specific [1]
(numbered positions) And thank you in advance, Seriously, I’ve spent 3
hours on this yesterday, and I still could not figure what is wrong!

I do know that this part works: //[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘USA.XP’ ]
which means that /count(preceding-sibling::*) + 1 does not work.
But you cannot image the number of variations I did with it, with no
success! So again, thankyou!

DominiqueOn Friday, November 13, 2015 at 4:26:01 AM UTC-5, Martin Webb wrote:

Hi Dominique,

What result are you expecting or trying to extract? If you let me know I
will take a look at it.

All the best,

Martin

On 12 November 2015 at 22:36, Dominique Dupuis <domini...@gmail.com <javascript:>> wrote:

I have this regex code that used to work in CF10 but since moving to
Lucee, it no longer works. (The problem is not Lucee, it is the Regex, and
Lucee just seems to be less forgiving…)
The code is:
<cfset ThisNode =
#XMLSearch(xmlResponse,"//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘#CanPost_ServiceRegion##xmldata.CanPost_service_code#’
]/count(preceding-sibling::) + 1")#>
The variable in the middle could be USA.SP.AIR for the purpuse of
testing: so
<cfset ThisNode =
#XMLSearch(xmlResponse,"//
[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[
= ‘USA.SP.AIR’ ]/count(preceding-sibling::*) + 1")#>

All the tests site that I’ve tried tell me the above is wrong, but I
could not fine one that explains what is wrong.

Can someone point me in the right direction?

The test xml file could be:

<?xml version="1.0" encoding="UTF_8"?> http://www.canadapost.ca/ws/ship/rate_v2"><price_quote><service_code>USA.EP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.EP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Expedited
Parcel
USA</service_name><price_details>19.400.000.000.0020.22<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.82</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>4</expected_transit_time><expected_delivery_date>2015_11_19</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.PW.PAK</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PAK?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide pak
USA</service_name><price_details>63.320.000.000.0065.06<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.74</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.PW.PARCEL</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PARCEL?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide parcel
USA</service_name><price_details>70.300.000.000.0072.23<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.93</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.SP.AIR</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.SP.AIR?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Small
Packet USA
Air</service_name><price_details>16.230.000.000.0016.23</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>
USA.TP</service_code><service_link rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.TP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Tracked
Packet _
USA</service_name><price_details>18.190.000.000.0018.96<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.77</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>6</expected_transit_time><expected_delivery_date>2015_11_23</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.XP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.XP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Xpresspost
USA</service_name><price_details>30.600.000.000.0033.43<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>2.83</adjustment_cost>9.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>true</guaranteed_delivery><expected_transit_time>3</expected_transit_time><expected_delivery_date>2015_11_18</expected_delivery_date></service_standard></price_quote></price_quotes>

I tried to add the

On Thursday, October 1, 2015 at 4:18:13 PM UTC-4, Dominique Dupuis wrote:

To keep things separate, I’ve mark a star on the posted solution
that worked, and created a new topic for the next problem I was facing.
(the Binary pdf problem). Dominique

On Thursday, September 24, 2015 at 1:21:49 PM UTC-4, Dominique Dupuis wrote:

Good, I can use these for further testing.

Moving on to next migration problem… I was testing this particular
line of code, that retreives the url of the actual label because I was told
both that Lucee handles PDF raw and that it did not handle it…
So I needed to fiind out if this was an issue:
A dump of the respond from Canada post API (cfhttp.FileContent) looks
like this (but shorten quite a lot):
Native Array (byte)Raw[60,63,120,115,99,1(…lots more
numbers…)15,97,103,101,115,62]
Base64 EncodedPD94(…lots more
whatever…)wIiBl]

On CF10-11 I used this: to show my shipping label so I can print
it.

On Lucee, this results in the browser telling me that “This PDF doc
might not be displayed correctly”… and it does not display at all. The
browser offers to try opening it with different viewers but the result is
the same when I do. They don’t read it as being a pdf file. This tells me
either Lucee can’t use pdf as type for the tag cfcontent, or the
conversion of raw fails. The wed site:
http://docs.lucee.org/reference/tags/content.html does not even
specify any accepted type! So I’m left in the dark as to what is wrong.
Thank you
Dominique

On Thursday, September 24, 2015 at 12:08:37 PM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

Glad it worked for you.

I would guess it may be down to whatever XML parser is being used
within the Whitebeam Xpath Testbed. It works OK using these ones:
http://www.xpathtester.com/xpath
http://codebeautify.org/Xpath-Tester
http://www.utilities-online.info/xpath

All the best,

Martin

On Thursday, September 24, 2015 at 4:50:05 PM UTC+1, Dominique Dupuis wrote:

Hi Martin,
You’re my new best friend!!
It works like a charm, almost everywhere, CF10, CF11 and Lucee. But
it does not work on the XPath Expression testbed site?!? This is not a big
deal, except for the fact that I still don’t know why it works so
differently (or not) from one place to the other.

For now, I will use your solution since it works in both target
environments. Now I’m still missing some understanding as to why it works.
I need just enough so I can track and fix potential problems in the many
more lines of codes that use XPath in this shipping module.
You say you use it to avoid having to deal with the namespaces
prefixes, but my limited understanding of XPath was that this was what
(this wild card) *: was suppose to do.

Thank you for your help!
Dominique

On Thursday, September 24, 2015 at 6:26:56 AM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

I have just tried the following XPath against your XML and it looks
to work OK in Lucee 4.5.1.022:

normalize-space(string(//*[local-name()=‘link’][@rel=‘label’]/@href))

I have used local-name() in the pas to avoid having to deal with the
namespaces prefixes.

All the best,

Martin

On Wednesday, September 23, 2015 at 9:02:26 PM UTC+1, Dominique Dupuis wrote:

To answer Tom, In this case, I’m trying to extract only the *href *of
the label. (notice there are other href in the same xml doc).
As suggested by Lutz, I tried adding changing ‘label’ for ““label””
without luck.

Further info: What i’m actually doing is converting an Carweaver
based online store, presently hosted on cf10 server and using a MSSQL
database, to a Lucee hosted server using MySQL database.
Cartweaver was already pretty much compatatible with Lucee. The
database conversion also was relatively easy. Now I’m left with ironing out
problems with my own customization codes. In this case, it is the shipping
module.
It makes extensive use of xmlsearch! And it is a long code! (with
various API connections for both UPS and Canada Post) So I need to not
just fix this particular one, but I need to understand what is going on so
I can find and correct the rest of this module.

What puzzles me is that CF gets the proper link
using (//*:link[@rel = ‘label’]/@href) while neither Lucee nor the web site
(online xmlsearch test site) returns a link with that. This could be the
“cf being forgiving” factor. But the online test web site does return the
proper link with …//:link… (Just removing the *) and Lucee still
returns empty with everything! //link, //link and even with
/descendant::link could the problem be with the prefix string in <cfset
GetArtifactURL = Replace(XmlSearch(Trim(
xmlResponse),"normalize-space(string(//
:link[@rel =
‘label’]/@href))"),"_","-",“all”)>

On Wednesday, September 23, 2015 at 10:49:26 AM UTC-4, lu...@lesener.de wrote:

On Tuesday, 22 September 2015 18:26:32 UTC+2, Dominique Dupuis wrote:

<cfset GetArtifactURL =
Replace(XmlSearch(Trim(xmlResponse),“normalize-space(string(//*:link[@rel =
‘label’]/@href))”),"_","-",“all”)>

Just a shot in the dark: What happens if you replace ‘label’ with
““label”” ?

rgds
Lutz


Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html


You received this message because you are subscribed to a topic in the
Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+un...@googlegroups.com <javascript:>.
To post to this group, send email to lu...@googlegroups.com <javascript:>
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com

The example I gave you is working for me in Lucee…On 13 November 2015 at 16:19, Dominique Dupuis <@Dominique_Dupuis> wrote:

I was doing my testing on http://codebeautify.org/Xpath-Tester wich was
one of the ones you recommended a few days ago. And it gives me an
error?!?
SyntaxError: The string
‘//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’] [* =
‘USA.XP’ ]/count(preceding-sibling–*) + 1’ is not a valid XPath expression.

On Friday, November 13, 2015 at 10:51:32 AM UTC-5, Dominique Dupuis wrote:

Hi Martin, Another way to put my question would be this: All I know when
I start my search is the data in one of the service_code nodes (for example
USA.TP). From that info, I need to figure out the position of the parent
node price_quote amongst the other price_quote in the grandparent node
price_quotes (so for USA.TP we want to return : 5 or USA.EP :1 etc).
This way, later in my code I can reference various notes using the specific
[1] (numbered positions) And thank you in advance, Seriously, I’ve spent 3
hours on this yesterday, and I still could not figure what is wrong!

I do know that this part works: //[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘USA.XP’ ]
which means that /count(preceding-sibling::*) + 1 does not work.
But you cannot image the number of variations I did with it, with no
success! So again, thankyou!

Dominique

On Friday, November 13, 2015 at 4:26:01 AM UTC-5, Martin Webb wrote:

Hi Dominique,

What result are you expecting or trying to extract? If you let me know I
will take a look at it.

All the best,

Martin

On 12 November 2015 at 22:36, Dominique Dupuis domini...@gmail.com wrote:

I have this regex code that used to work in CF10 but since moving to
Lucee, it no longer works. (The problem is not Lucee, it is the Regex, and
Lucee just seems to be less forgiving…)
The code is:
<cfset ThisNode =
#XMLSearch(xmlResponse,"//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘#CanPost_ServiceRegion##xmldata.CanPost_service_code#’
]/count(preceding-sibling::) + 1")#>
The variable in the middle could be USA.SP.AIR for the purpuse of
testing: so
<cfset ThisNode =
#XMLSearch(xmlResponse,"//
[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[
= ‘USA.SP.AIR’ ]/count(preceding-sibling::*) + 1")#>

All the tests site that I’ve tried tell me the above is wrong, but I
could not fine one that explains what is wrong.

Can someone point me in the right direction?

The test xml file could be:

<?xml version="1.0" encoding="UTF_8"?> http://www.canadapost.ca/ws/ship/rate_v2"><price_quote><service_code>USA.EP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.EP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Expedited
Parcel
USA</service_name><price_details>19.400.000.000.0020.22<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.82</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>4</expected_transit_time><expected_delivery_date>2015_11_19</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.PW.PAK</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PAK?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide pak
USA</service_name><price_details>63.320.000.000.0065.06<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.74</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.PW.PARCEL</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PARCEL?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide parcel
USA</service_name><price_details>70.300.000.000.0072.23<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.93</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.SP.AIR</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.SP.AIR?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Small
Packet USA
Air</service_name><price_details>16.230.000.000.0016.23</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>
USA.TP</service_code><service_link rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.TP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Tracked
Packet _
USA</service_name><price_details>18.190.000.000.0018.96<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.77</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>6</expected_transit_time><expected_delivery_date>2015_11_23</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.XP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.XP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Xpresspost
USA</service_name><price_details>30.600.000.000.0033.43<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>2.83</adjustment_cost>9.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>true</guaranteed_delivery><expected_transit_time>3</expected_transit_time><expected_delivery_date>2015_11_18</expected_delivery_date></service_standard></price_quote></price_quotes>

I tried to add the

On Thursday, October 1, 2015 at 4:18:13 PM UTC-4, Dominique Dupuis wrote:

To keep things separate, I’ve mark a star on the posted solution
that worked, and created a new topic for the next problem I was facing.
(the Binary pdf problem). Dominique

On Thursday, September 24, 2015 at 1:21:49 PM UTC-4, Dominique Dupuis wrote:

Good, I can use these for further testing.

Moving on to next migration problem… I was testing this particular
line of code, that retreives the url of the actual label because I was told
both that Lucee handles PDF raw and that it did not handle it…
So I needed to fiind out if this was an issue:
A dump of the respond from Canada post API (cfhttp.FileContent) looks
like this (but shorten quite a lot):
Native Array (byte)Raw[60,63,120,115,99,1(…lots more
numbers…)15,97,103,101,115,62]
Base64 EncodedPD94(…lots more
whatever…)wIiBl]

On CF10-11 I used this: to show my shipping label so I can print
it.

On Lucee, this results in the browser telling me that “This PDF doc
might not be displayed correctly”… and it does not display at all. The
browser offers to try opening it with different viewers but the result is
the same when I do. They don’t read it as being a pdf file. This tells me
either Lucee can’t use pdf as type for the tag cfcontent, or the
conversion of raw fails. The wed site:
http://docs.lucee.org/reference/tags/content.html does not even
specify any accepted type! So I’m left in the dark as to what is wrong.
Thank you
Dominique

On Thursday, September 24, 2015 at 12:08:37 PM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

Glad it worked for you.

I would guess it may be down to whatever XML parser is being used
within the Whitebeam Xpath Testbed. It works OK using these ones:
http://www.xpathtester.com/xpath
http://codebeautify.org/Xpath-Tester
http://www.utilities-online.info/xpath

All the best,

Martin

On Thursday, September 24, 2015 at 4:50:05 PM UTC+1, Dominique Dupuis wrote:

Hi Martin,
You’re my new best friend!!
It works like a charm, almost everywhere, CF10, CF11 and Lucee.
But it does not work on the XPath Expression testbed site?!? This is not a
big deal, except for the fact that I still don’t know why it works so
differently (or not) from one place to the other.

For now, I will use your solution since it works in both target
environments. Now I’m still missing some understanding as to why it works.
I need just enough so I can track and fix potential problems in the many
more lines of codes that use XPath in this shipping module.
You say you use it to avoid having to deal with the namespaces
prefixes, but my limited understanding of XPath was that this was what
(this wild card) *: was suppose to do.

Thank you for your help!
Dominique

On Thursday, September 24, 2015 at 6:26:56 AM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

I have just tried the following XPath against your XML and it
looks to work OK in Lucee 4.5.1.022:

normalize-space(string(//*[local-name()=‘link’][@rel=‘label’]/@href))

I have used local-name() in the pas to avoid having to deal with
the namespaces prefixes.

All the best,

Martin

On Wednesday, September 23, 2015 at 9:02:26 PM UTC+1, Dominique Dupuis wrote:

To answer Tom, In this case, I’m trying to extract only the *href
*of the label. (notice there are other href in the same xml
doc).
As suggested by Lutz, I tried adding changing ‘label’ for
““label”” without luck.

Further info: What i’m actually doing is converting an Carweaver
based online store, presently hosted on cf10 server and using a MSSQL
database, to a Lucee hosted server using MySQL database.
Cartweaver was already pretty much compatatible with Lucee. The
database conversion also was relatively easy. Now I’m left with ironing out
problems with my own customization codes. In this case, it is the shipping
module.
It makes extensive use of xmlsearch! And it is a long code! (with
various API connections for both UPS and Canada Post) So I need to not
just fix this particular one, but I need to understand what is going on so
I can find and correct the rest of this module.

What puzzles me is that CF gets the proper link
using (//*:link[@rel = ‘label’]/@href) while neither Lucee nor the web site
(online xmlsearch test site) returns a link with that. This could be the
“cf being forgiving” factor. But the online test web site does return the
proper link with …//:link… (Just removing the *) and Lucee still
returns empty with everything! //link, //link and even with
/descendant::link could the problem be with the prefix string in <cfset
GetArtifactURL = Replace(XmlSearch(Trim(
xmlResponse),"normalize-space(string(//
:link[@rel =
‘label’]/@href))"),"_","-",“all”)>

On Wednesday, September 23, 2015 at 10:49:26 AM UTC-4, lu...@lesener.de wrote:

On Tuesday, 22 September 2015 18:26:32 UTC+2, Dominique Dupuis wrote:

<cfset GetArtifactURL =
Replace(XmlSearch(Trim(xmlResponse),“normalize-space(string(//*:link[@rel =
‘label’]/@href))”),"_","-",“all”)>

Just a shot in the dark: What happens if you replace ‘label’
with ““label”” ?

rgds
Lutz


Love Lucee? Become a supporter and be part of the Lucee project today!


You received this message because you are subscribed to a topic in the
Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com


Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html


You received this message because you are subscribed to a topic in the
Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/01474649-b3ec-48ba-a49e-8f64c9a931f7%40googlegroups.com
https://groups.google.com/d/msgid/lucee/01474649-b3ec-48ba-a49e-8f64c9a931f7%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com

Hi Dominique,

This looks like it works:

count(//[local-name()=‘price_quote’] [[local-name()=‘service_code’] = ’
USA.TP’ ]/preceding-sibling::*)+1

This is returning 5 for me.

If you want the node itself you can use:
//[local-name()=‘price_quote’] [[local-name()=‘service_code’] = ‘USA.TP’ ]

Hope this helps.

All the best,

MartinOn 13 November 2015 at 15:51, Dominique Dupuis <@Dominique_Dupuis> wrote:

Hi Martin, Another way to put my question would be this: All I know when
I start my search is the data in one of the service_code nodes (for example
USA.TP). From that info, I need to figure out the position of the parent
node price_quote amongst the other price_quote in the grandparent node
price_quotes (so for USA.TP we want to return : 5 or USA.EP :1 etc).
This way, later in my code I can reference various notes using the specific
[1] (numbered positions) And thank you in advance, Seriously, I’ve spent 3
hours on this yesterday, and I still could not figure what is wrong!

I do know that this part works: //[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘USA.XP’ ]
which means that /count(preceding-sibling::*) + 1 does not work.
But you cannot image the number of variations I did with it, with no
success! So again, thankyou!

Dominique

On Friday, November 13, 2015 at 4:26:01 AM UTC-5, Martin Webb wrote:

Hi Dominique,

What result are you expecting or trying to extract? If you let me know I
will take a look at it.

All the best,

Martin

On 12 November 2015 at 22:36, Dominique Dupuis domini...@gmail.com wrote:

I have this regex code that used to work in CF10 but since moving to
Lucee, it no longer works. (The problem is not Lucee, it is the Regex, and
Lucee just seems to be less forgiving…)
The code is:
<cfset ThisNode =
#XMLSearch(xmlResponse,"//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘#CanPost_ServiceRegion##xmldata.CanPost_service_code#’
]/count(preceding-sibling::) + 1")#>
The variable in the middle could be USA.SP.AIR for the purpuse of
testing: so
<cfset ThisNode =
#XMLSearch(xmlResponse,"//
[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[
= ‘USA.SP.AIR’ ]/count(preceding-sibling::*) + 1")#>

All the tests site that I’ve tried tell me the above is wrong, but I
could not fine one that explains what is wrong.

Can someone point me in the right direction?

The test xml file could be:

<?xml version="1.0" encoding="UTF_8"?> http://www.canadapost.ca/ws/ship/rate_v2"><price_quote><service_code>USA.EP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.EP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Expedited
Parcel
USA</service_name><price_details>19.400.000.000.0020.22<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.82</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>4</expected_transit_time><expected_delivery_date>2015_11_19</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.PW.PAK</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PAK?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide pak
USA</service_name><price_details>63.320.000.000.0065.06<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.74</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.PW.PARCEL</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PARCEL?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide parcel
USA</service_name><price_details>70.300.000.000.0072.23<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.93</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.SP.AIR</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.SP.AIR?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Small
Packet USA
Air</service_name><price_details>16.230.000.000.0016.23</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>
USA.TP</service_code><service_link rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.TP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Tracked
Packet _
USA</service_name><price_details>18.190.000.000.0018.96<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.77</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>6</expected_transit_time><expected_delivery_date>2015_11_23</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.XP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.XP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Xpresspost
USA</service_name><price_details>30.600.000.000.0033.43<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>2.83</adjustment_cost>9.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>true</guaranteed_delivery><expected_transit_time>3</expected_transit_time><expected_delivery_date>2015_11_18</expected_delivery_date></service_standard></price_quote></price_quotes>

I tried to add the

On Thursday, October 1, 2015 at 4:18:13 PM UTC-4, Dominique Dupuis wrote:

To keep things separate, I’ve mark a star on the posted solution
that worked, and created a new topic for the next problem I was facing.
(the Binary pdf problem). Dominique

On Thursday, September 24, 2015 at 1:21:49 PM UTC-4, Dominique Dupuis wrote:

Good, I can use these for further testing.

Moving on to next migration problem… I was testing this particular
line of code, that retreives the url of the actual label because I was told
both that Lucee handles PDF raw and that it did not handle it…
So I needed to fiind out if this was an issue:
A dump of the respond from Canada post API (cfhttp.FileContent) looks
like this (but shorten quite a lot):
Native Array (byte)Raw[60,63,120,115,99,1(…lots more
numbers…)15,97,103,101,115,62]
Base64 EncodedPD94(…lots more
whatever…)wIiBl]

On CF10-11 I used this: to show my shipping label so I can print
it.

On Lucee, this results in the browser telling me that “This PDF doc
might not be displayed correctly”… and it does not display at all. The
browser offers to try opening it with different viewers but the result is
the same when I do. They don’t read it as being a pdf file. This tells me
either Lucee can’t use pdf as type for the tag cfcontent, or the
conversion of raw fails. The wed site:
http://docs.lucee.org/reference/tags/content.html does not even
specify any accepted type! So I’m left in the dark as to what is wrong.
Thank you
Dominique

On Thursday, September 24, 2015 at 12:08:37 PM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

Glad it worked for you.

I would guess it may be down to whatever XML parser is being used
within the Whitebeam Xpath Testbed. It works OK using these ones:
http://www.xpathtester.com/xpath
http://codebeautify.org/Xpath-Tester
http://www.utilities-online.info/xpath

All the best,

Martin

On Thursday, September 24, 2015 at 4:50:05 PM UTC+1, Dominique Dupuis wrote:

Hi Martin,
You’re my new best friend!!
It works like a charm, almost everywhere, CF10, CF11 and Lucee. But
it does not work on the XPath Expression testbed site?!? This is not a big
deal, except for the fact that I still don’t know why it works so
differently (or not) from one place to the other.

For now, I will use your solution since it works in both target
environments. Now I’m still missing some understanding as to why it works.
I need just enough so I can track and fix potential problems in the many
more lines of codes that use XPath in this shipping module.
You say you use it to avoid having to deal with the namespaces
prefixes, but my limited understanding of XPath was that this was what
(this wild card) *: was suppose to do.

Thank you for your help!
Dominique

On Thursday, September 24, 2015 at 6:26:56 AM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

I have just tried the following XPath against your XML and it looks
to work OK in Lucee 4.5.1.022:

normalize-space(string(//*[local-name()=‘link’][@rel=‘label’]/@href))

I have used local-name() in the pas to avoid having to deal with
the namespaces prefixes.

All the best,

Martin

On Wednesday, September 23, 2015 at 9:02:26 PM UTC+1, Dominique Dupuis wrote:

To answer Tom, In this case, I’m trying to extract only the *href
*of the label. (notice there are other href in the same xml
doc).
As suggested by Lutz, I tried adding changing ‘label’ for
““label”” without luck.

Further info: What i’m actually doing is converting an Carweaver
based online store, presently hosted on cf10 server and using a MSSQL
database, to a Lucee hosted server using MySQL database.
Cartweaver was already pretty much compatatible with Lucee. The
database conversion also was relatively easy. Now I’m left with ironing out
problems with my own customization codes. In this case, it is the shipping
module.
It makes extensive use of xmlsearch! And it is a long code! (with
various API connections for both UPS and Canada Post) So I need to not
just fix this particular one, but I need to understand what is going on so
I can find and correct the rest of this module.

What puzzles me is that CF gets the proper link
using (//*:link[@rel = ‘label’]/@href) while neither Lucee nor the web site
(online xmlsearch test site) returns a link with that. This could be the
“cf being forgiving” factor. But the online test web site does return the
proper link with …//:link… (Just removing the *) and Lucee still
returns empty with everything! //link, //link and even with
/descendant::link could the problem be with the prefix string in <cfset
GetArtifactURL = Replace(XmlSearch(Trim(
xmlResponse),"normalize-space(string(//
:link[@rel =
‘label’]/@href))"),"_","-",“all”)>

On Wednesday, September 23, 2015 at 10:49:26 AM UTC-4, lu...@lesener.de wrote:

On Tuesday, 22 September 2015 18:26:32 UTC+2, Dominique Dupuis wrote:

<cfset GetArtifactURL =
Replace(XmlSearch(Trim(xmlResponse),“normalize-space(string(//*:link[@rel =
‘label’]/@href))”),"_","-",“all”)>

Just a shot in the dark: What happens if you replace ‘label’ with
““label”” ?

rgds
Lutz


Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html


You received this message because you are subscribed to a topic in the
Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com


Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html

You received this message because you are subscribed to a topic in the
Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/8ca37973-81c9-4d39-a113-18eb6cb92447%40googlegroups.com
https://groups.google.com/d/msgid/lucee/8ca37973-81c9-4d39-a113-18eb6cb92447%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com

Ok, so I did underestimate the difficulties in switching to Lucee. Before
moving my live site, I did lots of testing… but evidently not enough. I
did not realise that Lucee may not output an error but could still
interpret some code differently, making my app fail without any bells or
alarms going off!

On top of that, my development environment is behaving very different than
my Live environment.
I’m a very decent amateur programmer, but I’m definitely not a pro. So at
this point, I have to admit, I’m over my head!
The guy (pro) I’ve been hiring to help me with difficult tasks is not
available right now, and I really need help quickly!

I need help to:
1- Validate or correct Lucee Development set up and possibly Validate or
correct Lucee live set up.
2- Help test cart checkout, in particular, help with tracking session
state. Check out page is where people are falling off my site where they
were not before moving to Lucce.

I receive valuable help on this post and since this is a continuation of
the original title, I thought I’d post this here.

DominiqueOn Friday, November 13, 2015 at 11:26:29 AM UTC-5, Martin Webb wrote:

The example I gave you is working for me in Lucee…

On 13 November 2015 at 16:19, Dominique Dupuis <domini...@gmail.com <javascript:>> wrote:

I was doing my testing on http://codebeautify.org/Xpath-Tester wich was
one of the ones you recommended a few days ago. And it gives me an
error?!?
SyntaxError: The string
‘//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’] [* =
‘USA.XP’ ]/count(preceding-sibling–*) + 1’ is not a valid XPath expression.

On Friday, November 13, 2015 at 10:51:32 AM UTC-5, Dominique Dupuis wrote:

Hi Martin, Another way to put my question would be this: All I know
when I start my search is the data in one of the service_code nodes (for
example USA.TP). From that info, I need to figure out the position of
the parent node price_quote amongst the other price_quote in the
grandparent node price_quotes (so for USA.TP we want to return : 5 or
USA.EP :1 etc). This way, later in my code I can reference various notes
using the specific [1] (numbered positions) And thank you in advance,
Seriously, I’ve spent 3 hours on this yesterday, and I still could not
figure what is wrong!

I do know that this part works: //[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘USA.XP’ ]
which means that /count(preceding-sibling::*) + 1 does not work.
But you cannot image the number of variations I did with it, with no
success! So again, thankyou!

Dominique

On Friday, November 13, 2015 at 4:26:01 AM UTC-5, Martin Webb wrote:

Hi Dominique,

What result are you expecting or trying to extract? If you let me know
I will take a look at it.

All the best,

Martin

On 12 November 2015 at 22:36, Dominique Dupuis domini...@gmail.com wrote:

I have this regex code that used to work in CF10 but since moving to
Lucee, it no longer works. (The problem is not Lucee, it is the Regex, and
Lucee just seems to be less forgiving…)
The code is:
<cfset ThisNode =
#XMLSearch(xmlResponse,"//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘#CanPost_ServiceRegion##xmldata.CanPost_service_code#’
]/count(preceding-sibling::) + 1")#>
The variable in the middle could be USA.SP.AIR for the purpuse of
testing: so
<cfset ThisNode =
#XMLSearch(xmlResponse,"//
[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[
= ‘USA.SP.AIR’ ]/count(preceding-sibling::*) + 1")#>

All the tests site that I’ve tried tell me the above is wrong, but I
could not fine one that explains what is wrong.

Can someone point me in the right direction?

The test xml file could be:

<?xml version="1.0" encoding="UTF_8"?> http://www.canadapost.ca/ws/ship/rate_v2"><price_quote><service_code>USA.EP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.EP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Expedited
Parcel
USA</service_name><price_details>19.400.000.000.0020.22<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.82</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>4</expected_transit_time><expected_delivery_date>2015_11_19</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.PW.PAK</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PAK?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide pak
USA</service_name><price_details>63.320.000.000.0065.06<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.74</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.PW.PARCEL</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PARCEL?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide parcel
USA</service_name><price_details>70.300.000.000.0072.23<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.93</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.SP.AIR</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.SP.AIR?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Small
Packet USA
Air</service_name><price_details>16.230.000.000.0016.23</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>
USA.TP</service_code><service_link rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.TP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Tracked
Packet _
USA</service_name><price_details>18.190.000.000.0018.96<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.77</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>6</expected_transit_time><expected_delivery_date>2015_11_23</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.XP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.XP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Xpresspost
USA</service_name><price_details>30.600.000.000.0033.43<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>2.83</adjustment_cost>9.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>true</guaranteed_delivery><expected_transit_time>3</expected_transit_time><expected_delivery_date>2015_11_18</expected_delivery_date></service_standard></price_quote></price_quotes>

I tried to add the

On Thursday, October 1, 2015 at 4:18:13 PM UTC-4, Dominique Dupuis wrote:

To keep things separate, I’ve mark a star on the posted solution
that worked, and created a new topic for the next problem I was facing.
(the Binary pdf problem). Dominique

On Thursday, September 24, 2015 at 1:21:49 PM UTC-4, Dominique Dupuis wrote:

Good, I can use these for further testing.

Moving on to next migration problem… I was testing this particular
line of code, that retreives the url of the actual label because I was told
both that Lucee handles PDF raw and that it did not handle it…
So I needed to fiind out if this was an issue:
A dump of the respond from Canada post API (cfhttp.FileContent)
looks like this (but shorten quite a lot):
Native Array (byte)Raw[60,63,120,115,99,1(…lots more
numbers…)15,97,103,101,115,62]
Base64 EncodedPD94(…lots more
whatever…)wIiBl]

On CF10-11 I used this: to show my shipping label so I can print
it.

On Lucee, this results in the browser telling me that “This PDF doc
might not be displayed correctly”… and it does not display at all. The
browser offers to try opening it with different viewers but the result is
the same when I do. They don’t read it as being a pdf file. This tells me
either Lucee can’t use pdf as type for the tag cfcontent, or the
conversion of raw fails. The wed site:
http://docs.lucee.org/reference/tags/content.html does not even
specify any accepted type! So I’m left in the dark as to what is wrong.
Thank you
Dominique

On Thursday, September 24, 2015 at 12:08:37 PM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

Glad it worked for you.

I would guess it may be down to whatever XML parser is being used
within the Whitebeam Xpath Testbed. It works OK using these ones:
http://www.xpathtester.com/xpath
http://codebeautify.org/Xpath-Tester
http://www.utilities-online.info/xpath

All the best,

Martin

On Thursday, September 24, 2015 at 4:50:05 PM UTC+1, Dominique Dupuis wrote:

Hi Martin,
You’re my new best friend!!
It works like a charm, almost everywhere, CF10, CF11 and Lucee.
But it does not work on the XPath Expression testbed site?!? This is not a
big deal, except for the fact that I still don’t know why it works so
differently (or not) from one place to the other.

For now, I will use your solution since it works in both target
environments. Now I’m still missing some understanding as to why it works.
I need just enough so I can track and fix potential problems in the many
more lines of codes that use XPath in this shipping module.
You say you use it to avoid having to deal with the namespaces
prefixes, but my limited understanding of XPath was that this was what
(this wild card) *: was suppose to do.

Thank you for your help!
Dominique

On Thursday, September 24, 2015 at 6:26:56 AM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

I have just tried the following XPath against your XML and it
looks to work OK in Lucee 4.5.1.022:

normalize-space(string(//*[local-name()=‘link’][@rel=‘label’]/@href))

I have used local-name() in the pas to avoid having to deal with
the namespaces prefixes.

All the best,

Martin

On Wednesday, September 23, 2015 at 9:02:26 PM UTC+1, Dominique Dupuis wrote:

To answer Tom, In this case, I’m trying to extract only the *href
*of the label. (notice there are other href in the same xml
doc).
As suggested by Lutz, I tried adding changing ‘label’ for
““label”” without luck.

Further info: What i’m actually doing is converting an Carweaver
based online store, presently hosted on cf10 server and using a MSSQL
database, to a Lucee hosted server using MySQL database.
Cartweaver was already pretty much compatatible with Lucee. The
database conversion also was relatively easy. Now I’m left with ironing out
problems with my own customization codes. In this case, it is the shipping
module.
It makes extensive use of xmlsearch! And it is a long code!
(with various API connections for both UPS and Canada Post) So I need to
not just fix this particular one, but I need to understand what is going on
so I can find and correct the rest of this module.

What puzzles me is that CF gets the proper link
using (//*:link[@rel = ‘label’]/@href) while neither Lucee nor the web site
(online xmlsearch test site) returns a link with that. This could be the
“cf being forgiving” factor. But the online test web site does return the
proper link with …//:link… (Just removing the *) and Lucee still
returns empty with everything! //link, //link and even with
/descendant::link could the problem be with the prefix string in <cfset
GetArtifactURL = Replace(XmlSearch(Trim(
xmlResponse),"normalize-space(string(//
:link[@rel =
‘label’]/@href))"),"_","-",“all”)>

On Wednesday, September 23, 2015 at 10:49:26 AM UTC-4, lu...@lesener.de wrote:

On Tuesday, 22 September 2015 18:26:32 UTC+2, Dominique Dupuis wrote:

<cfset GetArtifactURL =
Replace(XmlSearch(Trim(xmlResponse),“normalize-space(string(//*:link[@rel =
‘label’]/@href))”),"_","-",“all”)>

Just a shot in the dark: What happens if you replace ‘label’
with ““label”” ?

rgds
Lutz


Love Lucee? Become a supporter and be part of the Lucee project today!


You received this message because you are subscribed to a topic in the
Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com


Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html


You received this message because you are subscribed to a topic in the
Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+un...@googlegroups.com <javascript:>.
To post to this group, send email to lu...@googlegroups.com <javascript:>
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/01474649-b3ec-48ba-a49e-8f64c9a931f7%40googlegroups.com
https://groups.google.com/d/msgid/lucee/01474649-b3ec-48ba-a49e-8f64c9a931f7%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com

Start by checking the version of Lucee you have installed on dev and
production to ensure they are have the same updates. Also, you can export
(most) all the settings to an Application.cfc file in the “Export” menu
item to help compare the Lucee settings.

Other than that, I don’t quite understand what specific questions you are
asking us for.

Thanks!

~BradOn Thursday, December 24, 2015 at 11:23:41 AM UTC-6, Dominique Dupuis wrote:

Ok, so I did underestimate the difficulties in switching to Lucee. Before
moving my live site, I did lots of testing… but evidently not enough. I
did not realise that Lucee may not output an error but could still
interpret some code differently, making my app fail without any bells or
alarms going off!

On top of that, my development environment is behaving very different than
my Live environment.
I’m a very decent amateur programmer, but I’m definitely not a pro. So at
this point, I have to admit, I’m over my head!
The guy (pro) I’ve been hiring to help me with difficult tasks is not
available right now, and I really need help quickly!

I need help to:
1- Validate or correct Lucee Development set up and possibly Validate or
correct Lucee live set up.
2- Help test cart checkout, in particular, help with tracking session
state. Check out page is where people are falling off my site where they
were not before moving to Lucce.

I receive valuable help on this post and since this is a continuation of
the original title, I thought I’d post this here.

Dominique

On Friday, November 13, 2015 at 11:26:29 AM UTC-5, Martin Webb wrote:

The example I gave you is working for me in Lucee…

On 13 November 2015 at 16:19, Dominique Dupuis domini...@gmail.com wrote:

I was doing my testing on http://codebeautify.org/Xpath-Tester wich
was one of the ones you recommended a few days ago. And it gives me an
error?!?
SyntaxError: The string
‘//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’] [* =
‘USA.XP’ ]/count(preceding-sibling–*) + 1’ is not a valid XPath expression.

On Friday, November 13, 2015 at 10:51:32 AM UTC-5, Dominique Dupuis wrote:

Hi Martin, Another way to put my question would be this: All I know
when I start my search is the data in one of the service_code nodes (for
example USA.TP). From that info, I need to figure out the position of
the parent node price_quote amongst the other price_quote in the
grandparent node price_quotes (so for USA.TP we want to return : 5 or
USA.EP :1 etc). This way, later in my code I can reference various notes
using the specific [1] (numbered positions) And thank you in advance,
Seriously, I’ve spent 3 hours on this yesterday, and I still could not
figure what is wrong!

I do know that this part works: //[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘USA.XP’ ]
which means that /count(preceding-sibling::*) + 1 does not work.
But you cannot image the number of variations I did with it, with no
success! So again, thankyou!

Dominique

On Friday, November 13, 2015 at 4:26:01 AM UTC-5, Martin Webb wrote:

Hi Dominique,

What result are you expecting or trying to extract? If you let me know
I will take a look at it.

All the best,

Martin

On 12 November 2015 at 22:36, Dominique Dupuis domini...@gmail.com wrote:

I have this regex code that used to work in CF10 but since moving to
Lucee, it no longer works. (The problem is not Lucee, it is the Regex, and
Lucee just seems to be less forgiving…)
The code is:
<cfset ThisNode =
#XMLSearch(xmlResponse,"//[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[* = ‘#CanPost_ServiceRegion##xmldata.CanPost_service_code#’
]/count(preceding-sibling::) + 1")#>
The variable in the middle could be USA.SP.AIR for the purpuse of
testing: so
<cfset ThisNode =
#XMLSearch(xmlResponse,"//
[local-name()=‘price_quotes’]/[local-name()=‘price_quote’]
[
= ‘USA.SP.AIR’ ]/count(preceding-sibling::*) + 1")#>

All the tests site that I’ve tried tell me the above is wrong, but I
could not fine one that explains what is wrong.

Can someone point me in the right direction?

The test xml file could be:

<?xml version="1.0" encoding="UTF_8"?> http://www.canadapost.ca/ws/ship/rate_v2"><price_quote><service_code>USA.EP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.EP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Expedited
Parcel
USA</service_name><price_details>19.400.000.000.0020.22<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.82</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>4</expected_transit_time><expected_delivery_date>2015_11_19</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.PW.PAK</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PAK?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide pak
USA</service_name><price_details>63.320.000.000.0065.06<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.74</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.PW.PARCEL</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.PW.PARCEL?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Priority
Worldwide parcel
USA</service_name><price_details>70.300.000.000.0072.23<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>1.93</adjustment_cost>2.75</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>USA.SP.AIR</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.SP.AIR?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Small
Packet USA
Air</service_name><price_details>16.230.000.000.0016.23</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery></service_standard></price_quote><price_quote><service_code>
USA.TP</service_code><service_link rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.TP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Tracked
Packet _
USA</service_name><price_details>18.190.000.000.0018.96<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>0.77</adjustment_cost>4.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>false</guaranteed_delivery><expected_transit_time>6</expected_transit_time><expected_delivery_date>2015_11_23</expected_delivery_date></service_standard></price_quote><price_quote><service_code>USA.XP</service_code><service_link
rel=“service” href="
https://soa_gw.canadapost.ca:443/rs/ship/service/USA.XP?contract=0040024030&country=US"
media_type=“application/vnd.cpc.ship.rate_v2+xml”/><service_name>Xpresspost
USA</service_name><price_details>30.600.000.000.0033.43<option_code>DC</option_code><option_name>Delivery
confirmation</option_name><option_price>0</option_price><option_code>SO</option_code><option_name>Signature
option</option_name><option_price>0</option_price><adjustment_code>FUELSC</adjustment_code><adjustment_name>Fuel
surcharge</adjustment_name><adjustment_cost>2.83</adjustment_cost>9.25</price_details><weight_details/><service_standard><am_delivery>false</am_delivery><guaranteed_delivery>true</guaranteed_delivery><expected_transit_time>3</expected_transit_time><expected_delivery_date>2015_11_18</expected_delivery_date></service_standard></price_quote></price_quotes>

I tried to add the

On Thursday, October 1, 2015 at 4:18:13 PM UTC-4, Dominique Dupuis wrote:

To keep things separate, I’ve mark a star on the posted solution
that worked, and created a new topic for the next problem I was facing.
(the Binary pdf problem). Dominique

On Thursday, September 24, 2015 at 1:21:49 PM UTC-4, Dominique Dupuis wrote:

Good, I can use these for further testing.

Moving on to next migration problem… I was testing this
particular line of code, that retreives the url of the actual label because
I was told both that Lucee handles PDF raw and that it did not handle it…
So I needed to fiind out if this was an issue:
A dump of the respond from Canada post API (cfhttp.FileContent)
looks like this (but shorten quite a lot):
Native Array (byte)Raw[60,63,120,115,99,1(…lots more
numbers…)15,97,103,101,115,62]
Base64 EncodedPD94(…lots more
whatever…)wIiBl]

On CF10-11 I used this: to show my shipping label so I can print
it.

On Lucee, this results in the browser telling me that “This PDF doc
might not be displayed correctly”… and it does not display at all. The
browser offers to try opening it with different viewers but the result is
the same when I do. They don’t read it as being a pdf file. This tells me
either Lucee can’t use pdf as type for the tag cfcontent, or the
conversion of raw fails. The wed site:
http://docs.lucee.org/reference/tags/content.html does not even
specify any accepted type! So I’m left in the dark as to what is wrong.
Thank you
Dominique

On Thursday, September 24, 2015 at 12:08:37 PM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

Glad it worked for you.

I would guess it may be down to whatever XML parser is being used
within the Whitebeam Xpath Testbed. It works OK using these ones:
http://www.xpathtester.com/xpath
http://codebeautify.org/Xpath-Tester
http://www.utilities-online.info/xpath

All the best,

Martin

On Thursday, September 24, 2015 at 4:50:05 PM UTC+1, Dominique Dupuis wrote:

Hi Martin,
You’re my new best friend!!
It works like a charm, almost everywhere, CF10, CF11 and Lucee.
But it does not work on the XPath Expression testbed site?!? This is not a
big deal, except for the fact that I still don’t know why it works so
differently (or not) from one place to the other.

For now, I will use your solution since it works in both target
environments. Now I’m still missing some understanding as to why it works.
I need just enough so I can track and fix potential problems in the many
more lines of codes that use XPath in this shipping module.
You say you use it to avoid having to deal with the namespaces
prefixes, but my limited understanding of XPath was that this was what
(this wild card) *: was suppose to do.

Thank you for your help!
Dominique

On Thursday, September 24, 2015 at 6:26:56 AM UTC-4, mar...@cubicstate.com wrote:

Hi Dominique,

I have just tried the following XPath against your XML and it
looks to work OK in Lucee 4.5.1.022:

normalize-space(string(//*[local-name()=‘link’][@rel=‘label’]/@href))

I have used local-name() in the pas to avoid having to deal with
the namespaces prefixes.

All the best,

Martin

On Wednesday, September 23, 2015 at 9:02:26 PM UTC+1, Dominique Dupuis wrote:

To answer Tom, In this case, I’m trying to extract only the *href
*of the label. (notice there are other href in the same xml
doc).
As suggested by Lutz, I tried adding changing ‘label’ for
““label”” without luck.

Further info: What i’m actually doing is converting an
Carweaver based online store, presently hosted on cf10 server and using a
MSSQL database, to a Lucee hosted server using MySQL database.
Cartweaver was already pretty much compatatible with Lucee. The
database conversion also was relatively easy. Now I’m left with ironing out
problems with my own customization codes. In this case, it is the shipping
module.
It makes extensive use of xmlsearch! And it is a long code!
(with various API connections for both UPS and Canada Post) So I need to
not just fix this particular one, but I need to understand what is going on
so I can find and correct the rest of this module.

What puzzles me is that CF gets the proper link
using (//*:link[@rel = ‘label’]/@href) while neither Lucee nor the web site
(online xmlsearch test site) returns a link with that. This could be the
“cf being forgiving” factor. But the online test web site does return the
proper link with …//:link… (Just removing the *) and Lucee still
returns empty with everything! //link, //link and even with
/descendant::link could the problem be with the prefix string in <cfset
GetArtifactURL = Replace(XmlSearch(Trim(
xmlResponse),"normalize-space(string(//
:link[@rel =
‘label’]/@href))"),"_","-",“all”)>

On Wednesday, September 23, 2015 at 10:49:26 AM UTC-4, lu...@lesener.de wrote:

On Tuesday, 22 September 2015 18:26:32 UTC+2, Dominique Dupuis wrote:

<cfset GetArtifactURL =
Replace(XmlSearch(Trim(xmlResponse),“normalize-space(string(//*:link[@rel =
‘label’]/@href))”),"_","-",“all”)>

Just a shot in the dark: What happens if you replace ‘label’
with ““label”” ?

rgds
Lutz


Love Lucee? Become a supporter and be part of the Lucee project
today! - http://lucee.org/supporters/become-a-supporter.html


You received this message because you are subscribed to a topic in
the Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com
https://groups.google.com/d/msgid/lucee/90d02b2d-1462-4316-8049-016ae6f80767%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com


Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html


You received this message because you are subscribed to a topic in the
Google Groups “Lucee” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/lucee/ufp6vCVkz9s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/01474649-b3ec-48ba-a49e-8f64c9a931f7%40googlegroups.com
https://groups.google.com/d/msgid/lucee/01474649-b3ec-48ba-a49e-8f64c9a931f7%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


Martin Webb
Director, CUBICstate Ltd.

Tel: +44 (0)1422 352233
Web: www.cubicstate.com