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

Method nsOK

basex-core/src/main/java/org/basex/query/up/NamePool.java:66–81  ·  view source on GitHub ↗

Checks if no namespace conflicts occur. @return conflicting namespaces or null

()

Source from the content-addressed store, hash-verified

64 * @return conflicting namespaces or {@code null}
65 */
66 byte[][] nsOK() {
67 final Atts at = new Atts();
68 for(int i = 0; i < size; ++i) {
69 final NameCache nc = cache[i];
70 if(nc.add <= (nc.del ? 1 : 0)) continue;
71 final QNm nm = nc.name;
72 final byte[] prefix = nm.prefix(), uri = nm.uri();
73 // attributes with empty URI don't conflict with anything
74 if(nc.attr && uri.length == 0) continue;
75 final byte[] u = at.value(prefix);
76 if(u == null) at.add(prefix, uri);
77 // check if only one URI is assigned to a prefix
78 else if(!eq(uri, u)) return new byte[][] { uri, u };
79 }
80 return null;
81 }
82
83 /**
84 * Returns an index to an existing entry.

Callers 1

checkNamesMethod · 0.95

Calls 5

prefixMethod · 0.95
uriMethod · 0.95
valueMethod · 0.95
addMethod · 0.95
eqMethod · 0.65

Tested by

no test coverage detected