XQuery错误:E对于输入字符串:“5770000”

时间:2016-04-05 15:20:18

标签: xml xquery

我想通过xquery从xml中获取一些数据。 原始的xml类似于:

<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>

我写了一个类似的XQuery:

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>

我使用Oxygen进行转换。出现错误:

  

E输入字符串:“5770000”

我不知道哪里出错了。 enter image description here

1 个答案:

答案 0 :(得分:1)

我也在同一个班级。你需要将人口放在一个数字()中。您还需要告诉它使用第一个人口,因为XML中的某些城市有多个人口。

所以而不是

population > 5000000

你会有

number(population[1]) > 5000000