Mayoco
Mayoco

Reputation: 87

XQuery Error: E For input string: "5770000"

I want to grab some data from xml by xquery. The original xml is something like:

<mondial>
<country id="AAA" name="BBB">
<name>BBB</name>
<city id="CCC" country="AAA">
<name>DDD</name>
<population>XXXX</population>
<located_at type="XX"/>
</city>
...
</country>
...
</mondial>

I write a XQuery like that:

let $cs:=//city[population >5000000 and located_at/@type='sea']
let $countries := //country
for $country in $countries
for $city in $cs
where $country/@id =$city/@country
return <seacity>{data($city/name)},{data($country/name)}</seacity>

I use Oxygen to do the conversion. An error come out:

E For input string: "5770000"

I don't know where was wrong. enter image description here

Upvotes: 0

Views: 107

Answers (1)

user3846838
user3846838

Reputation: 36

I am also in the same class. You need to put the population inside a number(). You also need to tell it to use the first population since some cities in the XML have multiple populations.

So instead of

population > 5000000

you would have

number(population[1]) > 5000000

Upvotes: 1

Related Questions