In one of my projects I'm using
- XQuery 3.0
- Saxon HE 9.8 (transitive because of Camel)
- Spring Boot 2.1.0
- Apache Camel 2.22.0
I consume a XML message in which the following element occurs:
<mytimeelement></mytimeelement>
As you can see it is empty so I thought that the following XQuery-Expression would return an empty sequence:
$transaction/*:flags/*:mytimeelement
Unfortunately this seems not to be the case because calling the XQuery-Expression from above in an xs:time($arg)
like:
xs:time($transaction/*:flags/*:mytimeelement)
does not return an empty sequence as I would have expected but instead returns an exception:
Invalid time "" (too short)
The thing is: I want to use the xs:time($arg)
as validation that if a value is in the element it has to have the correct format, but if it's empty it doesn't matter. So I did this not only with xs:time
but also with xs:date
and xs:decimal
.
My question now is: Why is the expression not returning an empty sequence but an empty string? Or should I better use a cast as xs:time
instead?