0

Basically, this returns empty labels:

let $report := fn:doc('/db/junitReports/Report.xml')
return <label>{$report//testResult/text()}</label>

Report.xml:

<junit>
    <interfaceName>InterfaceName</interfaceName>
    <reportDate>2016-06-01</reportDate>
    <testResult>failure</testResult>
</junit> 

However, it shows entire xml when xPath to a particular element is not used:

let $report := fn:doc('/db/junitReports/Report.xml')
return <label>{$report}</label>

Which means that the file is accessible from the db.

I found a post where it was fixed by updating exist db to later version, but I am on the latest 2.1.2

user6419217
  • 59
  • 10

1 Answers1

0

I added a "*" namespace to the xPath to solve the issue:

return <label>{fn:doc(fn:concat($collection, '/', $child))//*:testResult/text()}</label>
user6419217
  • 59
  • 10