Parses the "EQName" rule. @param ns default namespace (can be null), or #SKIPCHECK to skip checks @param error optional error message. If not null, will be raised if no EQName is found @return QName or null @throws QueryException query exception
(final byte[] ns, final QueryError error)
| 4424 | * @throws QueryException query exception |
| 4425 | */ |
| 4426 | private QNm eQName(final byte[] ns, final QueryError error) throws QueryException { |
| 4427 | // parse URIQualifiedName |
| 4428 | final int p = pos; |
| 4429 | if(consume("Q{")) { |
| 4430 | final byte[] uri = bracedURILiteral(), name1 = ncName(null, true); |
| 4431 | if(name1.length != 0) { |
| 4432 | if(!consume(':')) return new QNm(name1, uri); |
| 4433 | final byte[] name2 = ncName(null, true); |
| 4434 | if(name2.length != 0) { |
| 4435 | if(uri.length == 0) throw error(PREFIXNOURI_X, name2); |
| 4436 | return new QNm(name1, name2, uri); |
| 4437 | } |
| 4438 | } |
| 4439 | pos = p; |
| 4440 | } |
| 4441 | |
| 4442 | // parse QName (null will only be returned if no error was raised) |
| 4443 | final byte[] nm = qName(error); |
| 4444 | if(nm.length == 0) return null; |
| 4445 | if(ns == SKIPCHECK) return new QNm(nm); |
| 4446 | |
| 4447 | // create new EQName and set namespace |
| 4448 | final QNm name = new QNm(nm, qc, sc); |
| 4449 | if(!name.hasURI()) { |
| 4450 | if(name.hasPrefix()) { |
| 4451 | pos = p; |
| 4452 | throw error(NOURI_X, name.prefix()); |
| 4453 | } |
| 4454 | name.uri(ns); |
| 4455 | } |
| 4456 | return name; |
| 4457 | } |
| 4458 | |
| 4459 | /** |
| 4460 | * Parses the "QName" rule. |
no test coverage detected