001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package com.sun.xml.ws.streaming;
038:
039: import javax.xml.namespace.QName;
040:
041: /**
042: * <p> The Attributes interface is essentially a version of the
043: * org.xml.sax.Attributes interface modified to use the JAX-WS QName class.</p>
044: *
045: * <p> Although namespace declarations can appear in the attribute list, the
046: * actual values of the local name and URI properties are
047: * implementation-specific. </p>
048: *
049: * <p> Applications that need to iterate through all the attributes can use the
050: * {@link #isNamespaceDeclaration} method to identify namespace declarations
051: * and skip them. </p>
052: *
053: * <p> Also, the URI property of an attribute will never be null. The value
054: * "" (empty string) is used for the URI of non-qualified attributes. </p>
055: *
056: * @author WS Development Team
057: */
058: public interface Attributes {
059:
060: /**
061: * Return the number of attributes in the list.
062: *
063: */
064: public int getLength();
065:
066: /**
067: * Return true if the attribute at the given index is a namespace
068: * declaration.
069: *
070: * <p> Implementations are encouraged to optimize this method by taking into
071: * account their internal representations of attributes. </p>
072: *
073: */
074: public boolean isNamespaceDeclaration(int index);
075:
076: /**
077: * Look up an attribute's QName by index.
078: *
079: */
080: public QName getName(int index);
081:
082: /**
083: * Look up an attribute's URI by index.
084: *
085: */
086: public String getURI(int index);
087:
088: /**
089: * Look up an attribute's local name by index.
090: * If attribute is a namespace declaration, result
091: * is expected including "xmlns:".
092: */
093: public String getLocalName(int index);
094:
095: /**
096: * Look up an attribute's prefix by index.
097: *
098: */
099: public String getPrefix(int index);
100:
101: /**
102: * Look up an attribute's value by index.
103: *
104: */
105: public String getValue(int index);
106:
107: /**
108: * Look up the index of an attribute by QName.
109: *
110: */
111: public int getIndex(QName name);
112:
113: /**
114: * Look up the index of an attribute by URI and local name.
115: *
116: */
117: public int getIndex(String uri, String localName);
118:
119: /**
120: * Look up the index of an attribute by local name.
121: *
122: */
123: public int getIndex(String localName);
124:
125: /**
126: * Look up the value of an attribute by QName.
127: *
128: */
129: public String getValue(QName name);
130:
131: /**
132: * Look up the value of an attribute by URI and local name.
133: *
134: */
135: public String getValue(String uri, String localName);
136:
137: /**
138: * Look up the value of an attribute by local name.
139: *
140: */
141: public String getValue(String localName);
142: }
|