KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > om > NamespaceDeclarations


1 package net.sf.saxon.om;
2
3 /**
4  * This interface represents a collection of namespace declarations or
5  * undeclarations, typically those appearing together in an element start tag.
6  * The order of declarations has no significance, and there will be no duplicates
7  * (that is, each declaration has a different prefix).
8  */

9
10 public interface NamespaceDeclarations {
11
12     /**
13      * Get the number of declarations (and undeclarations) in this list.
14      */

15
16     public int getLength();
17
18     /**
19      * Get the prefix of the n'th declaration (or undeclaration) in the list,
20      * counting from zero.
21      * @param index the index identifying which declaration is required.
22      * @return the namespace prefix. For a declaration or undeclaration of the
23      * default namespace, this is the zero-length string.
24      * @throws IndexOutOfBoundsException if the index is out of range.
25      */

26
27     public String JavaDoc getPrefix(int index);
28
29     /**
30      * Get the namespace URI of the n'th declaration (or undeclaration) in the list,
31      * counting from zero.
32      * @param index the index identifying which declaration is required.
33      * @return the namespace URI. For a namespace undeclaration, this is the
34      * zero-length string.
35      * @throws IndexOutOfBoundsException if the index is out of range.
36      */

37
38     public String JavaDoc getURI(int index);
39
40     /**
41      * Get the n'th declaration in the list in the form of a namespace code. Namespace
42      * codes can be translated into a prefix and URI by means of methods in the
43      * NamePool
44      * @param index the index identifying which declaration is required.
45      * @return the namespace code. This is an integer whose upper half indicates
46      * the prefix (0 represents the default namespace), and whose lower half indicates
47      * the URI (0 represents an undeclaration).
48      * @throws IndexOutOfBoundsException if the index is out of range.
49      * @see NamePool#getPrefixFromNamespaceCode(int)
50      * @see NamePool#getURIFromNamespaceCode(int)
51      */

52
53     public int getNamespaceCode(int index);
54
55     /**
56      * Get all the namespace codes, as an array.
57      * @param buffer a sacrificial array that the method is free to use to contain the result.
58      * May be null.
59      * @return an integer array containing namespace codes. The array may be filled completely
60      * with namespace codes, or it may be incompletely filled, in which case a -1 integer acts
61      * as a terminator.
62      */

63
64     public int[] getNamespaceCodes(int[] buffer);
65 }
66
67
68 //
69
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
70
// you may not use this file except in compliance with the License. You may obtain a copy of the
71
// License at http://www.mozilla.org/MPL/
72
//
73
// Software distributed under the License is distributed on an "AS IS" basis,
74
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
75
// See the License for the specific language governing rights and limitations under the License.
76
//
77
// The Original Code is: all this file.
78
//
79
// The Initial Developer of the Original Code is Michael H. Kay.
80
//
81
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
82
//
83
// Contributor(s): none.
84
//
85
Popular Tags