Path: blob/master/src/java.xml/share/classes/javax/xml/stream/events/StartElement.java
40955 views
/*1* Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.xml.stream.events;2627import javax.xml.namespace.QName;28import javax.xml.namespace.NamespaceContext;29import java.util.Iterator;3031/**32* The StartElement interface provides access to information about33* start elements. A StartElement is reported for each Start Tag34* in the document.35*36* @version 1.037* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.38* @since 1.639*/40public interface StartElement extends XMLEvent {4142/**43* Get the name of this event44* @return the qualified name of this event45*/46public QName getName();4748/**49* Returns an Iterator of non-namespace attributes declared on this START_ELEMENT.50* Returns an empty iterator if there are no attributes.51* The iterator must contain only implementations of the52* {@link Attribute} interface.53* Attributes are fundamentally unordered and may be reported54* in any order.55*56* @return a readonly Iterator over Attribute interfaces, or an57* empty iterator58*/59public Iterator<Attribute> getAttributes();6061/**62* Returns an Iterator of namespaces declared on this element.63* This Iterator does not contain previously declared namespaces64* unless they appear on the current START_ELEMENT.65* Therefore this list may contain redeclared namespaces and duplicate namespace66* declarations. Use the getNamespaceContext() method to get the67* current context of namespace declarations.68*69* <p>The iterator must contain only implementations of the70* {@link Namespace} interface.71*72* <p>A {@link Namespace} is an {@link Attribute}. One73* can iterate over a list of namespaces as a list of attributes.74* However this method returns only the list of namespaces75* declared on this START_ELEMENT and does not76* include the attributes declared on this START_ELEMENT.77*78* Returns an empty iterator if there are no namespaces.79*80* @return a readonly Iterator over Namespace interfaces, or an81* empty iterator82*83*/84public Iterator<Namespace> getNamespaces();8586/**87* Returns the attribute referred to by the qname.88* @param name the qname of the desired attribute89* @return the attribute corresponding to the name value or null90*/91public Attribute getAttributeByName(QName name);9293/**94* Gets a read-only namespace context. If no context is95* available this method will return an empty namespace context.96* The NamespaceContext contains information about all namespaces97* in scope for this StartElement.98*99* @return the current namespace context100*/101public NamespaceContext getNamespaceContext();102103/**104* Gets the value that the prefix is bound to in the105* context of this element. Returns null if106* the prefix is not bound in this context107* @param prefix the prefix to lookup108* @return the uri bound to the prefix or null109*/110public String getNamespaceURI(String prefix);111}112113114