01 package javax.xml.stream.events;
02
03 import javax.xml.namespace.QName;
04 import javax.xml.namespace.NamespaceContext;
05
06 import java.util.Map;
07 import java.util.Iterator;
08
09 /**
10 * The StartElement interface provides access to information about
11 * start elements. A StartElement is reported for each Start Tag
12 * in the document.
13 *
14 * @version 1.0
15 * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
16 * @since 1.6
17 */
18 public interface StartElement extends XMLEvent {
19
20 /**
21 * Get the name of this event
22 * @return the qualified name of this event
23 */
24 public QName getName();
25
26 /**
27 * Returns an Iterator of non-namespace declared attributes declared on
28 * this START_ELEMENT,
29 * returns an empty iterator if there are no attributes. The
30 * iterator must contain only implementations of the javax.xml.stream.Attribute
31 * interface. Attributes are fundamentally unordered and may not be reported
32 * in any order.
33 *
34 * @return a readonly Iterator over Attribute interfaces, or an
35 * empty iterator
36 */
37 public Iterator getAttributes();
38
39 /**
40 * Returns an Iterator of namespaces declared on this element.
41 * This Iterator does not contain previously declared namespaces
42 * unless they appear on the current START_ELEMENT.
43 * Therefore this list may contain redeclared namespaces and duplicate namespace
44 * declarations. Use the getNamespaceContext() method to get the
45 * current context of namespace declarations.
46 *
47 * <p>The iterator must contain only implementations of the
48 * javax.xml.stream.Namespace interface.
49 *
50 * <p>A Namespace isA Attribute. One
51 * can iterate over a list of namespaces as a list of attributes.
52 * However this method returns only the list of namespaces
53 * declared on this START_ELEMENT and does not
54 * include the attributes declared on this START_ELEMENT.
55 *
56 * Returns an empty iterator if there are no namespaces.
57 *
58 * @return a readonly Iterator over Namespace interfaces, or an
59 * empty iterator
60 *
61 */
62 public Iterator getNamespaces();
63
64 /**
65 * Returns the attribute referred to by this name
66 * @param name the qname of the desired name
67 * @return the attribute corresponding to the name value or null
68 */
69 public Attribute getAttributeByName(QName name);
70
71 /**
72 * Gets a read-only namespace context. If no context is
73 * available this method will return an empty namespace context.
74 * The NamespaceContext contains information about all namespaces
75 * in scope for this StartElement.
76 *
77 * @return the current namespace context
78 */
79 public NamespaceContext getNamespaceContext();
80
81 /**
82 * Gets the value that the prefix is bound to in the
83 * context of this element. Returns null if
84 * the prefix is not bound in this context
85 * @param prefix the prefix to lookup
86 * @return the uri bound to the prefix or null
87 */
88 public String getNamespaceURI(String prefix);
89 }
|