Debian Codegraph @

net/sf/saxon/functions/NamespaceUri_1.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.functions;
9
10 import net.sf.saxon.expr.XPathContext;
11 import net.sf.saxon.om.Item;
12 import net.sf.saxon.om.NodeInfo;
13 import net.sf.saxon.om.One;
14 import net.sf.saxon.om.ZeroOrOne;
15 import net.sf.saxon.trans.XPathException;
16 import net.sf.saxon.value.AnyURIValue;
17 import net.sf.saxon.value.AtomicValue;
18
19 /**
20 * This class supports the namespace-uri() function
21 */
22
23 public class NamespaceUri_1 extends ScalarSystemFunction {
24
25 @Override
26 public AtomicValue evaluate(Item item, XPathContext context) throws XPathException {
27 String uri = ((NodeInfo) item).getURI();
28 return new AnyURIValue(uri);
29 }
30
31 @Override
32 public ZeroOrOne<? extends AtomicValue> resultWhenEmpty() {
33 return new One<>(new AnyURIValue(""));
34 }
35
36 public String getCompilerName() {
37 return "NamespaceUriFnCompiler";
38 }
39
40 }
41