Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#270 Unknown namecode during XQuery parsing

v8.2
closed
Michael Kay
5
2012-10-08
2004-12-22
Michael Kay
No

A query such as the following:

for $v in doc("foo.xml")/*
return
<e a="{$v/child::element(e)}"/>

results in:

java.lang.IllegalArgumentException: Unknown name code
1048575
at
net.sf.saxon.om.NamePool.unknownNameCode(NamePool.java:657)

at net.sf.saxon.om.NamePool.getURI(NamePool.java:509)
at
net.sf.saxon.expr.ExpressionParser.parseKindTest(ExpressionParser.java:1359)

The problem is present in both 8.1.1 and 8.2. It occurs
when a nodetest such as element(e) is used within an
expression within an attribute of a direct element
constructor.

The following source fix (to 8.2) solves the immediate
problem but has not been extensively regression tested.

In 8.2, net.sf.saxon.expr.ExpressionParser, change line
1387 from

nameCode = makeNameCode(t.currentTokenValue, true) &
0xfffff;

to

nameCode = makeNameCode(t.currentTokenValue, true);

In lines 1410 and 1428, change

nameCode

to

nameCode & 0xfffff

Discussion