Exist: doc-available() should return false(), not an error, when encountering parsing errors

Created on 19 Mar 2017  路  9Comments  路  Source: eXist-db/exist

What is the problem

The fn:doc-available() function is returning en error when the URI contains non-well-formed XML.

What did you expect

The fn:doc-available() function should return false() when the URI cannot return a document node. See https://www.w3.org/TR/xpath-functions-31/#func-doc-available.

Describe how to reproduce or add a test

The following query:

xquery version "3.1";

fn:doc-available("https://www.kingjamesbibleonline.org/Genesis-Chapter-1_Original-1611-KJV/")

... returns the following error:

err:FODC0005 An error occurred while parsing https://www.kingjamesbibleonline.org/Genesis-Chapter-1_Original-1611-KJV/: Open quote is expected for attribute "lang" associated with an element type "html". [source: xquery version "3.1"; fn:doc-available("https://www.kingjamesbibleonline.org/Genesis-Chapter-1_Original-1611-KJV/")]

Saxon and BaseX both return false(). QT3's tests for this function (https://dev.w3.org/cvsweb/2011/QT3-test-suite/fn/doc-available.xml?rev=1.9;content-type=text%2Fx-cvsweb-markup) don't seem to include a test for this possibility, but I believe the expected behavior is clear enough from the spec.

Context information

  • eXist-db version: 3.1.0
  • Java version: 1.8.0_121-b13
  • Operating system: macOS
  • 64 bit
  • Any custom changes in e.g. conf.xml: no
bug

All 9 comments

It was closed without test, reopen...

@shabanovd It is not possible to write an automated XQuery Test without introducing external dependencies. As such the test will need to be manual, which I have done, and which you could also do. Re-opening this issue makes no sense as the issue has been fixed, you can confirm that for yourself by testing it. So I am again closing this issue.

@adamretter I tested your fix in develop 0151784a7 and can confirm it fixes the issue as reported. Many thanks!

Seems there has been a regression here, testing on 3.5.0

@tuurma do you still have an issue on 3.5.0? If so, how do I reproduce it? Let me know, I am happy to fix...

@adamretter I tested using @joewiz's example above

fn:doc-available("https://www.kingjamesbibleonline.org/Genesis-Chapter-1_Original-1611-KJV/")

and I am getting FODC0005 as he described

@tuurma Okay I will take a look...

@tuurma Just sent a PR for your issue. Please ask @wolfgangmm to merge before tomorrow 12:00 UTC.

so what wil fn:doc-available() return is it points to a collection? false() or the exception?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joewiz picture joewiz  路  3Comments

merenyics picture merenyics  路  3Comments

mathias-goebel picture mathias-goebel  路  4Comments

adamretter picture adamretter  路  4Comments

mathias-goebel picture mathias-goebel  路  4Comments