KickJava   Java API By Example, From Geeks To Geeks.

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


1 package net.sf.saxon.om;
2
3
4
5 /**
6  * AttributeCollection represents the collection of attributes available on a particular element
7  * node. It is modelled on the SAX2 Attributes interface, but is extended firstly to work with
8  * Saxon NamePools, and secondly to provide type information as required by the XPath 2.0 data model.
9  */

10
11 public interface AttributeCollection {
12
13     /**
14      * Return the number of attributes in the list.
15      *
16      * @return The number of attributes in the list.
17      */

18
19     int getLength();
20
21     /**
22      * Get the namecode of an attribute (by position).
23      *
24      * @param index The position of the attribute in the list.
25      * @return The name code of the attribute, or -1 if there is no attribute at that position.
26      */

27
28     int getNameCode(int index);
29
30
31     /**
32      * Get the type annotation of an attribute (by position).
33      *
34      * @param index The position of the attribute in the list.
35      * @return The type annotation, as the fingerprint of the type name.
36      * The bit {@link net.sf.saxon.om.NodeInfo.IS_DTD_TYPE} represents a DTD-derived type.
37      */

38
39     int getTypeAnnotation(int index);
40
41     /**
42      * Get the locationID of an attribute (by position)
43      * @param index The position of the attribute in the list.
44      * @return The location identifier of the attribute. This can be supplied
45      * to a {@link net.sf.saxon.event.LocationProvider} in order to obtain the
46      * actual system identifier and line number of the relevant location
47      */

48
49     int getLocationId(int index);
50
51     /**
52      * Get the systemId part of the location of an attribute, at a given index.
53      *
54      * <p>Attribute location information is not available from a SAX parser, so this method
55      * is not useful for getting the location of an attribute in a source document. However,
56      * in a Saxon result document, the location information represents the location in the
57      * stylesheet of the instruction used to generate this attribute, which is useful for
58      * debugging.</p>
59      * @param index the required attribute
60      * @return the systemId of the location of the attribute
61      */

62
63     String JavaDoc getSystemId(int index);
64
65     /**
66      * Get the line number part of the location of an attribute, at a given index.
67      *
68      * <p>Attribute location information is not available from a SAX parser, so this method
69      * is not useful for getting the location of an attribute in a source document. However,
70      * in a Saxon result document, the location information represents the location in the
71      * stylesheet of the instruction used to generate this attribute, which is useful for
72      * debugging.</p>
73      * @param index the required attribute
74      * @return the line number of the location of the attribute
75      */

76
77     int getLineNumber(int index);
78
79     /**
80      * Get the properties of an attribute (by position)
81      * @param index The position of the attribute in the list.
82      * @return The properties of the attribute. This is a set
83      * of bit-settings defined in class {@link net.sf.saxon.event.ReceiverOptions}. The
84      * most interesting of these is {{@link net.sf.saxon.event.ReceiverOptions#DEFAULTED_ATTRIBUTE},
85      * which indicates an attribute that was added to an element as a result of schema validation.
86      */

87
88     int getProperties(int index);
89
90     /**
91      * Get the prefix of the name of an attribute (by position).
92      *
93      * @param index The position of the attribute in the list.
94      * @return The prefix of the attribute name as a string, or null if there
95      * is no attribute at that position. Returns "" for an attribute that
96      * has no prefix.
97      */

98
99     String JavaDoc getPrefix(int index);
100
101     /**
102      * Get the lexical QName of an attribute (by position).
103      *
104      * @param index The position of the attribute in the list.
105      * @return The lexical QName of the attribute as a string, or null if there
106      * is no attribute at that position.
107      */

108
109     String JavaDoc getQName(int index);
110
111     /**
112      * Get the local name of an attribute (by position).
113      *
114      * @param index The position of the attribute in the list.
115      * @return The local name of the attribute as a string, or null if there
116      * is no attribute at that position.
117      */

118
119     String JavaDoc getLocalName(int index);
120
121     /**
122      * Get the namespace URI of an attribute (by position).
123      *
124      * @param index The position of the attribute in the list.
125      * @return The local name of the attribute as a string, or null if there
126      * is no attribute at that position.
127      */

128
129     String JavaDoc getURI(int index);
130
131     /**
132      * Get the index of an attribute (by name).
133      *
134      * @param uri The namespace uri of the attribute.
135      * @param localname The local name of the attribute.
136      * @return The index position of the attribute
137      */

138
139     int getIndex(String JavaDoc uri, String JavaDoc localname);
140
141     /**
142      * Get the index, given the fingerprint
143      */

144
145     int getIndexByFingerprint(int fingerprint);
146
147     /**
148      * Get the attribute value using its fingerprint
149      */

150
151     String JavaDoc getValueByFingerprint(int fingerprint);
152
153     /**
154      * Get the value of an attribute (by name).
155      *
156      * @param uri The namespace uri of the attribute.
157      * @param localname The local name of the attribute.
158      * @return The index position of the attribute
159      */

160
161     public String JavaDoc getValue(String JavaDoc uri, String JavaDoc localname);
162
163     /**
164      * Get the value of an attribute (by position).
165      *
166      * @param index The position of the attribute in the list.
167      * @return The attribute value as a string, or null if
168      * there is no attribute at that position.
169      */

170
171     String JavaDoc getValue(int index);
172
173     /**
174      * Determine whether a given attribute has the is-ID property set
175      */

176
177     boolean isId(int index);
178 }
179
180 //
181
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
182
// you may not use this file except in compliance with the License. You may obtain a copy of the
183
// License at http://www.mozilla.org/MPL/
184
//
185
// Software distributed under the License is distributed on an "AS IS" basis,
186
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
187
// See the License for the specific language governing rights and limitations under the License.
188
//
189
// The Original Code is: all this file.
190
//
191
// The Initial Developer of the Original Code is Michael H. Kay.
192
//
193
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
194
//
195
// Contributor(s): none.
196
//
197

198
Popular Tags