unknown name code during parsing

Help
marcvc
2004-12-16
2012-10-08
  • marcvc

    marcvc - 2004-12-16

    Michael,

    using Saxon 8.1.1, consider the following query:

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

    It 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)
    at net.sf.saxon.expr.ExpressionParser.parseNodeTest(ExpressionParser.java:1226)
    at net.sf.saxon.expr.ExpressionParser.parseBasicStep(ExpressionParser.java:1146)
    at net.sf.saxon.expr.ExpressionParser.parseStepExpression(ExpressionParser.java:1005)
    at net.sf.saxon.expr.ExpressionParser.parseRelativePath(ExpressionParser.java:978)
    ...

    Thanks,
    Marc

     
    • Michael Kay

      Michael Kay - 2004-12-22

      Thanks. This problem is still present in 8.2. It occurs when a construct such as element(x) appears as a step within a path expression within an attribute of a direct element constructor in XQuery (name resolution in this situation is rather unusual because the namespace declarations are not known at the time the expression is parsed): they might appear after the attribute. I have added a test case (qxmp198).

      The following source change fixes the immediate problem, though I have not tested for side effects:

      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

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks