KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > functions > InScopePrefixes


1 package net.sf.saxon.functions;
2 import net.sf.saxon.expr.XPathContext;
3 import net.sf.saxon.om.*;
4 import net.sf.saxon.trans.XPathException;
5 import net.sf.saxon.value.StringValue;
6
7 import java.util.ArrayList JavaDoc;
8 import java.util.Iterator JavaDoc;
9 import java.util.List JavaDoc;
10
11 /**
12 * This class supports fuctions get-in-scope-prefixes()
13 */

14
15 public class InScopePrefixes extends SystemFunction {
16
17     /**
18     * Iterator over the results of the expression
19     */

20
21     public SequenceIterator iterate(XPathContext context) throws XPathException {
22         NodeInfo element = (NodeInfo)argument[0].evaluateItem(context);
23         NamespaceResolver resolver = new InscopeNamespaceResolver(element);
24         Iterator JavaDoc iter = resolver.iteratePrefixes();
25         List JavaDoc list = new ArrayList JavaDoc(10);
26         while (iter.hasNext()) {
27             list.add(StringValue.makeStringValue((String JavaDoc)iter.next()));
28         }
29         return new ListIterator(list);
30
31     }
32
33 }
34
35 //
36
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
37
// you may not use this file except in compliance with the License. You may obtain a copy of the
38
// License at http://www.mozilla.org/MPL/
39
//
40
// Software distributed under the License is distributed on an "AS IS" basis,
41
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
42
// See the License for the specific language governing rights and limitations under the License.
43
//
44
// The Original Code is: all this file.
45
//
46
// The Initial Developer of the Original Code is Michael H. Kay
47
//
48
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
49
//
50
// Contributor(s): none.
51
//
52
Popular Tags