Hello everyone,

I am using SaxonEE9-4-0-4J and I try to use maps in a query but I get this error :

java.lang.ClassCastException: equals on StringValue is not allowed
        at net.sf.saxon.value.StringValue.equals(StringValue.java:319)
        at java.util.HashMap.put(Unknown Source)
        at java.util.HashSet.add(Unknown Source)
        at com.saxonica.functions.map.ImmutableMap.keys(ImmutableMap.java:431)
        at com.saxonica.functions.map.ImmutableMap.size(ImmutableMap.java:148)
        at com.saxonica.functions.map.MapSize$1.call(MapSize.java:94)
        at net.sf.saxon.functions.IntegratedFunctionCall.call(IntegratedFunction
Call.java:298)
        at CE_main_1433936385.process(file:/query12_s_test.xqy:65535)
        at com.saxonica.bytecode.CompiledExpression.process(CompiledExpression.j
ava:60)
        at net.sf.saxon.query.XQueryExpression.run(XQueryExpression.java:414)
        at net.sf.saxon.Query.runQuery(Query.java:860)
        at net.sf.saxon.Query.doQuery(Query.java:376)
        at net.sf.saxon.Query.main(Query.java:97)
Fatal error during query: java.lang.ClassCastException: equals on StringValue is
 not allowed

This is my query :

declare namespace map="http://www.w3.org/2005/xpath-functions/map";

<result>
{
let $test := ( '0P' ,'11')
let $ids := map:new(
   for $item in distinct-values($test)
       return map:entry(string($item),true()) 

return <test>{map:size($ids)}</test>
}
</result>

I don't understand what is wrong in this specific example.

Can someone help me ?

Thank you,

Johann


--
Signature messagerie
Johann LEGAYE
 
 

Johann LEGAYE
Ingénieur Développement 8 avenue Yves Brunaud - 31770 Colomiers Tél : 05.67.20.20.34 - Std : 05.67.20.20.30 - Fax : 05.67.20.20.30