【发布时间】:2017-03-15 18:43:34
【问题描述】:
declare variable $fb := doc("factbook.xml")/mondial;
for $c in $fb//country
where ($c/encompassed/@continent = 'f0_119') and ($c/@population < 100000)
return concat('Country: ',$c/name, ', Population: ',$c/@population);
它返回:
Type Error: Type of value '
()
' does not match sequence type: xs:anyAtomicType?
At characters 11681-11698
At File "q2_3.xq", line 4, characters 13-67
At File "q2_3.xq", line 4, characters 13-67
At File "q2_3.xq", line 4, characters 13-67
但是,如果我不执行 concat 返回,只需命名或填充它就会起作用,最奇怪的是我还有另一个程序:
declare variable $fb := doc("factbook.xml")/mondial;
for $c in $fb//country
where $c/religions = 'Seventh-Day Adventist'
order by $c/name
return concat('Country: ',$c/name, ', Population: ',$c/@population);
返回语法完全相同,但是,它可以工作。 为什么会这样?
【问题讨论】:
标签: xquery