|
8 | 8 | import org.basex.query.expr.*; |
9 | 9 | import org.basex.query.func.*; |
10 | 10 | import org.basex.query.value.*; |
11 | | -import org.basex.query.value.array.*; |
12 | 11 | import org.basex.query.value.item.*; |
13 | 12 | import org.basex.query.value.map.*; |
14 | 13 | import org.basex.query.value.node.*; |
@@ -82,29 +81,25 @@ public Item item(final QueryContext qc, final InputInfo ii) throws QueryExceptio |
82 | 81 | tb.add(kind.toString(Token.string(qname.local()))); |
83 | 82 | } else if(kind.oneOf(Kind.COMMENT, Kind.TEXT)) { |
84 | 83 | tb.add(type.toString()); |
85 | | - } else if(parent instanceof final JNode jparent) { |
86 | | - final JNode jnode = (JNode) node; |
87 | | - final Item key = jnode.key; |
88 | | - byte[] get = null; |
| 84 | + } else if(parent instanceof JNode) { |
| 85 | + final Item key = ((JNode) node).key; |
89 | 86 | final byte[] string = key.string(info); |
90 | | - if(jparent.value instanceof XQArray) { |
91 | | - tb.add("*[").add(key).add("]"); |
92 | | - } else if(key instanceof AStr || key instanceof Atm || key instanceof Uri) { |
93 | | - if(XMLToken.isNCName(string)) { |
94 | | - tb.add(string); |
95 | | - } else { |
96 | | - get = QueryString.toQuoted(string); |
97 | | - } |
| 87 | + if(key instanceof AStr || key instanceof Atm || key instanceof Uri) { |
| 88 | + // string, untypedAtomic, anyURI: NCName, or quoted string |
| 89 | + tb.add(XMLToken.isNCName(string) ? string : QueryString.toQuoted(string)); |
98 | 90 | } else if(key instanceof ANum) { |
99 | | - get = string; |
| 91 | + // numeric (includes array indexes) |
| 92 | + tb.add(string); |
100 | 93 | } else if(key instanceof final QNm qnm) { |
101 | | - tb.add(qnm.eqName()); |
| 94 | + // QName: EQName literal |
| 95 | + tb.add('#').add(qnm.eqName()); |
102 | 96 | } else if(key instanceof Bln) { |
103 | | - get = Token.concat(string, "()"); |
| 97 | + // boolean |
| 98 | + tb.add(string).add("()"); |
104 | 99 | } else { |
105 | | - get = Token.concat(key.type.toString(), '(', QueryString.toQuoted(string), ')'); |
| 100 | + // any other type |
| 101 | + tb.add(key.type.toString()).add('(').add(QueryString.toQuoted(string)).add(')'); |
106 | 102 | } |
107 | | - if(get != null) tb.add("get(").add(get).add(')'); |
108 | 103 | } |
109 | 104 | // optional index |
110 | 105 | if(indexes && !kind.oneOf(Kind.ATTRIBUTE, Kind.JNODE)) { |
|
0 commit comments