MCPcopy Create free account
hub / github.com/BaseXdb/basex / eQName

Method eQName

basex-core/src/main/java/org/basex/query/QueryParser.java:4426–4457  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 15

annotationsMethod · 0.95
optionDeclMethod · 0.95
decimalFormatDeclMethod · 0.95
functionDeclMethod · 0.95
typeDeclMethod · 0.95
namedRecordTypeDeclMethod · 0.95
arrowMethod · 0.95
validateMethod · 0.95
pragmaMethod · 0.95
simpleNodeTestMethod · 0.95
functionItemMethod · 0.95
literalMethod · 0.95

Calls 9

bracedURILiteralMethod · 0.95
ncNameMethod · 0.95
errorMethod · 0.95
qNameMethod · 0.95
hasURIMethod · 0.95
hasPrefixMethod · 0.95
prefixMethod · 0.95
uriMethod · 0.95
consumeMethod · 0.45

Tested by

no test coverage detected