Does QExo XQuery string-join work? - xquery

When I run string-join, I get a weird output like this:
<clinic>
<Name>Olive Street Pediatrics</Name>
<Address>1500 Olive St, Los Angeles, CA 90015</Address>
<PhoneNumberList>'\u04bc','\u04e4'</PhoneNumberList>
<NumberOfPatientGroups>4</NumberOfPatientGroups>
</clinic>
Notice the PhoneNumberList.
The output reported by Altova XMLSpy looks correct (using the same XQuery file)
<clinic>
<Name>Olive Street Pediatrics</Name>
<Address>1500 Olive St, Los Angeles, CA 90015</Address>
<PhoneNumberList>213-512-7457,213-512-7465</PhoneNumberList>
<NumberOfPatientGroups>4</NumberOfPatientGroups>
</clinic>
Does string-join work on Qexo?
Here is my XML file
Here is my Xquery file
I use kawa-1.9.1.jar

In this case Altova is producing the correct result. The bug is with Qexo.
Running the query in another processor (XQSharp) produced the same result as Altova.

Related

Is it possible that two exact same inputs give two different outputs using the Google Cloud API (advanced)

We are working for a customer implementing a solution which uses the Google Translate API (advanced edition). We have an issue now, because we found that translating identical input results in different outputs.
For example, the dutch input string "Goudse 48+ kaas belegen 1/16 Noord Hollandse weidemelk" is translated to French.
The first output gives: "Gouda 48+ fromage affiné 1/16 Lait de prairie de Hollande du Nord"
The second output gives: "Gouda 48+ fromage affiné 1/16 Lait des prés de Hollande du Nord"
This while being translated shortly after each other. In total, within one file of ± 250 products and ± 25 colums, 267 differences appear.
Does anyone know how this is possible? Or what we can do about it?

Supporting Airport codes in geocode & calculate route

Is there any API to get geocode for airport code?
For ex: if I need to calculate time from home(say its Malibu) to LAX(Los Angeles Intl. Airport), Ideally I would follow below steps:
Get my home address geo location(via geocoder)
Get LAX geo location(via geocoder)
Use above as source and destination in "calculateroute".
However when I use "LAX" in geocoder, its gives some place in CHE(Switzerland).
If I append with country(USA), its listing some other place in Georgia.
*https://geocoder.api.here.com/6.2/geocode.json?app_id=MY-APP-ID&app_code=MY-APP-CODEgen=9&searchtext=LAX
https://geocoder.api.here.com/6.2/geocode.json?app_id=MY-APP-ID&app_code=MY-APP-CODEgen=9&searchtext=LAX,USA*
Is there any alternate way to do it OR the only way is for me to maintain a map of IATA airport codes with their geo coordinates and use it directly in calculateroute?
To get the geocode of an Airport:
Use Landmark geocoding: categoryids=4581
categoryids
xs:integer
Limit landmark results to one or more categories. Examples:
Highway exits: 116
Airports: 4581
Tourist attractions: 7999
Example:
http://geocoder.api.here.com/6.2/search.json?categoryids=4581&gen=8&jsonattributes=1&language=en-US&maxresults=20&searchtext=LAX&app_id={YOUR_APP_ID}&app_code={YOUR_APP_CODE}
Read more at developer.here.com/documentation/geocoder/topics/resource-search.html

How to get the items count in xml using marklogic

I am new to MarkLogic ..I need to get the total count of books from the following XML. Can anyone suggest me.
<bk:bookstore xmlns:bk="http://www.bookstore.org">
<bk:book category='Computer'>
<bk:author>Gambardella, Matthew</bk:author>
<bk:title>XML Developer's Guide</bk:title>
<bk:price>44.95</bk:price>
<bk:publish_year>1995</bk:publish_year>
<bk:description>An in-depth look at creating applications with XML.
</bk:description>
</bk:book>
<bk:book category='Fantasy'>
<bk:author>Ralls, Kim</bk:author>
<bk:title>Midnight Rain</bk:title>
<bk:price>5.95</bk:price>
<bk:publish_year>2000</bk:publish_year>
<bk:description>A former architect battles corporate zombies, an evil
sorceress, and her own childhood to become queen of the world.
</bk:description>
</bk:book>
<bk:book category='Comic'>
<bk:author>Robert M. Overstreet</bk:author>
<bk:title>The Overstreet Indian Arrowheads Identification </bk:title>
<bk:price>2000</bk:price>
<bk:publish_year>1991</bk:publish_year>
<bk:description>A leading expert and dedicated collector, Robert M.
Overstreet has been writing The Official Overstreet Identification and
Price
Guide to Indian Arrowheads for more than 21 years</bk:description>
</bk:book>
<bk:book category='Comic'>
<bk:author>Randall Fuller</bk:author>
<bk:title>The Book That Changed America</bk:title>
<bk:price>1000</bk:price>
<bk:publish_year>2017</bk:publish_year>
<bk:description>The New York Times Book Review Throughout its history
America has been torn in two by debates over ideals and beliefs.
</bk:description>
</bk:book>
</bk:bookstore>
Can anyone find the solution for this question as I am new to this.
Id suggest using a cts:count-aggregate in combination with cts:element-reference. This requires you to have a element range index on book.
cts:count-aggregate(cts:element-reference(fn:QName("http://www.bookstore.org", "book")))
If performance isn't too critical and your document count isn't too large, you could also count with fn:count.
declare namespace bk="http://www.bookstore.org";
fn:count(//bk:book)
Try this-
declare namespace bk="http://www.bookstore.org";
let $book_xml :=
<bk:bookstore xmlns:bk="http://www.bookstore.org">
</bk:book>
........
........
</bk:book>
</bk:bookstore>
return fn:count($book_xml//bk:book)
Hope That Helps !

Serving a vCard (.vcf) file through Iron Router

I'm trying to wrap my head around how I can deliver a file through Iron Router. Here is what I am trying to accomplish:
1) User opens URL like http://website.com/vcard/:_id
2) Meteor generates vCard file
BEGIN:VCARD
VERSION:3.0
N:Gump;Forrest;;Mr.
FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
PHOTO;VALUE=URL;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif
TEL;TYPE=WORK,VOICE:(111) 555-1212
TEL;TYPE=HOME,VOICE:(404) 555-1212
ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
LABEL;TYPE=WORK:100 Waters Edge\nBaytown\, LA 30314\nUnited States of Ameri
ca
ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
LABEL;TYPE=HOME:42 Plantation St.\nBaytown\, LA 30314\nUnited States of Ame
rica
EMAIL;TYPE=PREF,INTERNET:forrestgump#example.com
REV:2008-04-24T19:52:43Z
END:VCARD
3) User gets .vcf file and it runs on their phone, Outlook, etc.
Thanks!
it has little to do with iron router. You need something that can return simple text file. Here is a demo which kind of does that:
http://meteorpad.com/pad/TbjQfAnmTAFQcyZ5a/Leaderboard

RSS feed for gas prices and how to interpret the feed

I am trying to add a RSS feed of gas prices based on location to my application.
I googled for RSS feed for gas prices and bumped onto Motortrend's gas price feed
http://www.motortrend.com/widgetrss/gas-
The feed seems to be fine, but the price value seem to be depicted in alphabets as below
Chevron 3921 Irvine Blvd, Irvine, CA 92602 (0.0 miles)
Monday, May 10, 2010 9:16 AM
Regular: ZEIECHK Plus: ZEHGIHC Premium: ZEGJEGE Diesel: N/A
How do I interpret these value to come up with a value for the gas price? Or is it internal to Motortrend's and cannot be used elsewhere?
View the source of Vista Motortrend Sidebar by downloading file, renaming file extension to .zip. Then unzip source and look at /js/gas.js file. You will find a js function called parsePrice(). It is basically a character conversion to find the Unicode value, and some simple math.

Resources