Package org.basex.query.value.item
Class QNm
java.lang.Object
org.basex.query.expr.ExprInfo
org.basex.query.expr.Expr
org.basex.query.value.Value
org.basex.query.value.item.Item
org.basex.query.value.item.QNm
QName item (
xs:QName).- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionQNm(byte[] name) Constructor.QNm(byte[] name, byte[] uri) Constructor.QNm(byte[] prefix, byte[] local, byte[] uri) Constructor.Constructor.QNm(byte[] name, StaticContext sc) Constructor, binding a statically known namespace.Constructor.Constructor.Constructor.Constructor for converting a Java QName. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the difference between the current and the specified item.booleaneq(Item item, Collation coll, StaticContext sc, InputInfo ii) Compares the items for equality.booleanCompares the specified name.byte[]eqName()Returns an EQName representation.static byte[]eqName(byte[] uri, byte[] local) Returns an EQName representation.static StringReturns an EQName representation.booleanThis function is e.g.intReturns a hash code for this value.booleanChecks if the name contains a prefix.booleanhasURI()Checks if the URI of this QName has been explicitly set.byte[]id()Returns a unique representation of the QName.byte[]local()Returns the local name.voidplan(QueryString qs) Creates a query string.byte[]prefix()Returns the prefix.byte[]prefixId()Returns a unique representation of the QName.byte[]prefixId(byte[] ns) Returns a unique representation of the QName.byte[]Returns the QName string if it has a prefix, orprefixId()otherwise.static QNmresolve(byte[] name, byte[] def, StaticContext sc, InputInfo ii) Resolves a QName string.static QNmresolve(byte[] name, StaticContext sc) Resolves a QName string.byte[]string()Returns the string value.byte[]Returns a string representation of the value.toJava()Returns a Java representation of the value.byte[]uri()Returns the URI of this QName.voiduri(byte[] u) Sets the URI of this QName.byte[]xdmInfo()Returns data model info.Methods inherited from class org.basex.query.value.item.Item
atomItem, atomSize, atomValue, bool, cache, comparable, dbl, ddo, dec, description, ebv, equiv, flt, input, instanceOf, item, itemAt, iter, itr, materialize, persistent, plan, refineType, reverse, sameKey, score, seqType, size, subsequence, test, typeIdMethods inherited from class org.basex.query.value.Value
accept, checkUp, compile, copy, count, exprSize, has, inline, inlineable, isEmpty, isItem, iter, iterator, materialize, serialize, serialize, serialize, valueMethods inherited from class org.basex.query.expr.Expr
arg, args, atomIter, data, data, funcType, hasFreeVars, indexAccessible, isSimple, markTailCalls, mergeEbv, optimize, simplifyFor, typeCheck, uses, vacuous, visitAllMethods inherited from class org.basex.query.expr.ExprInfo
toErrorString, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EMPTY
QName: empty. -
XML_BASE
QName: xml:base. -
REST_ERROR
QName: rest:error. -
EQNAME
URL pattern (matching Clark and EQName notation).
-
-
Constructor Details
-
QNm
public QNm(byte[] name) Constructor.- Parameters:
name- name
-
QNm
Constructor.- Parameters:
name- name
-
QNm
public QNm(byte[] name, byte[] uri) Constructor.- Parameters:
name- nameuri- namespace URI
-
QNm
Constructor.- Parameters:
name- nameuri- namespace URI
-
QNm
Constructor.- Parameters:
name- nameuri- namespace URI
-
QNm
Constructor, binding a statically known namespace. If no namespace is found, the namespace uri is set tonull.- Parameters:
name- namesc- static context
-
QNm
Constructor for converting a Java QName.- Parameters:
name- qname
-
QNm
Constructor.- Parameters:
prefix- prefixlocal- local nameuri- namespace uri
-
QNm
public QNm(byte[] prefix, byte[] local, byte[] uri) Constructor.- Parameters:
prefix- prefixlocal- local nameuri- namespace uri
-
-
Method Details
-
resolve
Resolves a QName string.- Parameters:
name- name to resolvesc- static context (can benull)- Returns:
- string
- Throws:
QueryException- query exception
-
resolve
public static QNm resolve(byte[] name, byte[] def, StaticContext sc, InputInfo ii) throws QueryException Resolves a QName string.- Parameters:
name- name to resolvedef- default namespace (can benull)sc- static context (can benull)ii- input info- Returns:
- string
- Throws:
QueryException- query exception
-
uri
public void uri(byte[] u) Sets the URI of this QName.- Parameters:
u- the uri to be set (can benull, or an empty or non-empty string)
-
uri
public byte[] uri()Returns the URI of this QName.- Returns:
- uri
-
hasURI
public boolean hasURI()Checks if the URI of this QName has been explicitly set.- Returns:
- result of check
-
string
Description copied from class:ItemReturns a string representation of the value. -
string
public byte[] string()Returns the string value.- Returns:
- string value
-
eq
Description copied from class:ItemCompares the items for equality.- Specified by:
eqin classItem- Parameters:
item- item to be comparedcoll- collation (can benull)sc- static context; required for comparing items of type xs:QName (can benull)ii- input info (can benull)- Returns:
- result of check
- Throws:
QueryException- query exception
-
eq
Compares the specified name.- Parameters:
qnm- name to be compared- Returns:
- result of check
-
diff
Description copied from class:ItemReturns the difference between the current and the specified item. This function is overwritten by the corresponding implementations.- Overrides:
diffin classItem- Parameters:
item- item to be comparedcoll- collation (can benull)ii- input info (can benull)- Returns:
- difference
- Throws:
QueryException- query exception
-
hasPrefix
public boolean hasPrefix()Checks if the name contains a prefix.- Returns:
- result of check
-
prefix
public byte[] prefix()Returns the prefix.- Returns:
- prefix
-
local
public byte[] local()Returns the local name.- Returns:
- local name
-
id
public byte[] id()Returns a unique representation of the QName.- If a URI exists, the EQName notation is used.
- Otherwise, if a prefix exists, the prefix and local name is returned.
- Otherwise, the local name is returned.
- Returns:
- QName as token
-
eqName
public byte[] eqName()Returns an EQName representation.- Returns:
- QName as token
-
prefixId
public byte[] prefixId()Returns a unique representation of the QName.- Returns:
- QName as token
-
prefixId
public byte[] prefixId(byte[] ns) Returns a unique representation of the QName.- Skips the prefix if the namespace of the QName equals the specified one.
- Returns a prefixed name if the namespace URI is statically known.
- Otherwise,
id()is called.
- Parameters:
ns- default uri (can benull)- Returns:
- QName as token
-
prefixString
public byte[] prefixString()Returns the QName string if it has a prefix, orprefixId()otherwise.- Returns:
- QName as token
-
toJava
Description copied from class:ValueReturns a Java representation of the value. -
hash
Description copied from class:ValueReturns a hash code for this value. -
xdmInfo
public byte[] xdmInfo()Description copied from class:Item -
equals
Description copied from class:ExprThis function is e.g. called by:If.optimize(CompileContext),Switch.optimize(CompileContext),Typeswitch.optimize(CompileContext), in order to discard identical expressions.CmpR.mergeEbv(Expr, boolean, CompileContext)orCmpSR.mergeEbv(Expr, boolean, CompileContext), in order to merge expressions with identical input.CmpG.optimize(CompileContext)orCmpV.optimize(CompileContext), in order to pre-evaluate equality tests.CmpG.optimize(CompileContext)orPos.get(Expr, CmpV.OpV, InputInfo, CompileContext), in order to compare the start and end value.PathCache, in order to find identical root values at runtime.
-
plan
Description copied from class:ExprInfoCreates a query string. -
eqName
public static byte[] eqName(byte[] uri, byte[] local) Returns an EQName representation.- Parameters:
uri- URIlocal- local name- Returns:
- QName as token
-
eqName
Returns an EQName representation.- Parameters:
uri- URIlocal- local name- Returns:
- QName as token
-