View Javadoc
1   /*
2    * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  package com.sun.xml.internal.ws.streaming;
27  
28  import javax.xml.namespace.QName;
29  
30  /**
31   * <p> The Attributes interface is essentially a version of the
32   * org.xml.sax.Attributes interface modified to use the JAX-WS QName class.</p>
33   *
34   * <p> Although namespace declarations can appear in the attribute list, the
35   * actual values of the local name and URI properties are
36   * implementation-specific. </p>
37   *
38   * <p> Applications that need to iterate through all the attributes can use the
39   * {@link #isNamespaceDeclaration} method to identify namespace declarations
40   * and skip them. </p>
41   *
42   * <p> Also, the URI property of an attribute will never be null. The value
43   * "" (empty string) is used for the URI of non-qualified attributes. </p>
44   *
45   * @author WS Development Team
46   */
47  public interface Attributes {
48  
49      /**
50       * Return the number of attributes in the list.
51       *
52       */
53      public int getLength();
54  
55      /**
56       * Return true if the attribute at the given index is a namespace
57       * declaration.
58       *
59       * <p> Implementations are encouraged to optimize this method by taking into
60       * account their internal representations of attributes. </p>
61       *
62       */
63      public boolean isNamespaceDeclaration(int index);
64  
65      /**
66       * Look up an attribute's QName by index.
67       *
68       */
69      public QName getName(int index);
70  
71      /**
72       * Look up an attribute's URI by index.
73       *
74       */
75      public String getURI(int index);
76  
77      /**
78       * Look up an attribute's local name by index.
79       * If attribute is a namespace declaration, result
80       * is expected including "xmlns:".
81       */
82      public String getLocalName(int index);
83  
84      /**
85       * Look up an attribute's prefix by index.
86       *
87       */
88      public String getPrefix(int index);
89  
90      /**
91       * Look up an attribute's value by index.
92       *
93       */
94      public String getValue(int index);
95  
96      /**
97       * Look up the index of an attribute by QName.
98       *
99       */
100     public int getIndex(QName name);
101 
102     /**
103      * Look up the index of an attribute by URI and local name.
104      *
105      */
106     public int getIndex(String uri, String localName);
107 
108     /**
109      * Look up the index of an attribute by local name.
110      *
111      */
112     public int getIndex(String localName);
113 
114     /**
115      * Look up the value of an attribute by QName.
116      *
117      */
118     public String getValue(QName name);
119 
120     /**
121      * Look up the value of an attribute by URI and local name.
122      *
123      */
124     public String getValue(String uri, String localName);
125 
126     /**
127      * Look up the value of an attribute by local name.
128      *
129      */
130     public String getValue(String localName);
131 }