- java.lang.Object
-
- com.sun.xml.fastinfoset.stax.events.EventBase
-
- com.sun.xml.fastinfoset.stax.events.StartElementEvent
-
- All Implemented Interfaces:
javax.xml.stream.events.StartElement,javax.xml.stream.events.XMLEvent,javax.xml.stream.XMLStreamConstants
public class StartElementEvent extends EventBase implements javax.xml.stream.events.StartElement
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<javax.xml.namespace.QName,javax.xml.stream.events.Attribute>_attributesprivate javax.xml.namespace.NamespaceContext_contextprivate java.util.List<javax.xml.stream.events.Namespace>_namespacesprivate javax.xml.namespace.QName_qname-
Fields inherited from class com.sun.xml.fastinfoset.stax.events.EventBase
_eventType, _location
-
-
Constructor Summary
Constructors Constructor Description StartElementEvent()StartElementEvent(java.lang.String prefix, java.lang.String uri, java.lang.String localpart)StartElementEvent(javax.xml.namespace.QName qname)StartElementEvent(javax.xml.stream.events.StartElement startelement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(javax.xml.stream.events.Attribute attr)voidaddAttributes(java.util.Iterator<? extends javax.xml.stream.events.Attribute> attrs)voidaddNamespace(javax.xml.stream.events.Namespace namespace)voidaddNamespaces(java.util.Iterator<? extends javax.xml.stream.events.Namespace> namespaces)javax.xml.stream.events.AttributegetAttributeByName(javax.xml.namespace.QName qname)Returns the attribute referred to by this namejava.util.Iterator<javax.xml.stream.events.Attribute>getAttributes()Returns an Iterator of non-namespace declared attributes returns an empty iterator if there are no attributes.javax.xml.namespace.QNamegetName()Get the name of this eventjava.lang.StringgetNamespace()javax.xml.namespace.NamespaceContextgetNamespaceContext()Gets a read-only namespace context.java.util.Iterator<javax.xml.stream.events.Namespace>getNamespaces()Returns an Iterator of namespaces declared on this element.java.lang.StringgetNamespaceURI(java.lang.String prefix)Gets the value that the prefix is bound to in the context of this element.protected voidinit()java.lang.StringnameAsString()Return this event as Stringvoidreset()voidsetName(javax.xml.namespace.QName qname)voidsetNamespaceContext(javax.xml.namespace.NamespaceContext context)java.lang.StringtoString()-
Methods inherited from class com.sun.xml.fastinfoset.stax.events.EventBase
asCharacters, asEndElement, asStartElement, getEventType, getLocation, getSchemaType, getSystemId, isAttribute, isCharacters, isEndDocument, isEndElement, isEntityReference, isNamespace, isProcessingInstruction, isStartDocument, isStartElement, setEventType, setLocation, writeAsEncodedUnicode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.xml.stream.events.XMLEvent
asCharacters, asEndElement, asStartElement, getEventType, getLocation, getSchemaType, isAttribute, isCharacters, isEndDocument, isEndElement, isEntityReference, isNamespace, isProcessingInstruction, isStartDocument, isStartElement, writeAsEncodedUnicode
-
-
-
-
Field Detail
-
_attributes
private java.util.Map<javax.xml.namespace.QName,javax.xml.stream.events.Attribute> _attributes
-
_namespaces
private java.util.List<javax.xml.stream.events.Namespace> _namespaces
-
_context
private javax.xml.namespace.NamespaceContext _context
-
_qname
private javax.xml.namespace.QName _qname
-
-
Constructor Detail
-
StartElementEvent
public StartElementEvent()
-
StartElementEvent
public StartElementEvent(java.lang.String prefix, java.lang.String uri, java.lang.String localpart)
-
StartElementEvent
public StartElementEvent(javax.xml.namespace.QName qname)
-
StartElementEvent
public StartElementEvent(javax.xml.stream.events.StartElement startelement)
-
-
Method Detail
-
reset
public void reset()
-
init
protected final void init()
-
getName
public javax.xml.namespace.QName getName()
Get the name of this event- Specified by:
getNamein interfacejavax.xml.stream.events.StartElement- Returns:
- the qualified name of this event
-
getAttributes
public java.util.Iterator<javax.xml.stream.events.Attribute> getAttributes()
Returns an Iterator of non-namespace declared attributes returns an empty iterator if there are no attributes. The iterator must contain only implementations of the javax.xml.stream.Attribute interface. Attributes are fundamentally unordered and may not be reported in any order.- Specified by:
getAttributesin interfacejavax.xml.stream.events.StartElement- Returns:
- a readonly Iterator over Attribute interfaces, or an empty iterator
-
getNamespaces
public java.util.Iterator<javax.xml.stream.events.Namespace> getNamespaces()
Returns an Iterator of namespaces declared on this element. This Iterator does not contain previously declared namespaces unless they appear on the current START_ELEMENT. Therefore this list may contain redeclared namespaces and duplicate namespace declarations. Use the getNamespaceContext() method to get the current context of namespace declarations.The iterator must contain only implementations of the javax.xml.stream.Namespace interface.
A Namespace is an Attribute. One can iterate over a list of namespaces as a list of attributes. However this method returns only the list of namespaces declared on this START_ELEMENT and does not include the attributes declared on this START_ELEMENT.
- Specified by:
getNamespacesin interfacejavax.xml.stream.events.StartElement- Returns:
- a readonly Iterator over Namespace interfaces, or an empty iterator if there are no namespaces.
-
getAttributeByName
public javax.xml.stream.events.Attribute getAttributeByName(javax.xml.namespace.QName qname)
Returns the attribute referred to by this name- Specified by:
getAttributeByNamein interfacejavax.xml.stream.events.StartElement- Parameters:
qname- the qname of the desired name- Returns:
- the attribute corresponding to the name value or null
-
getNamespaceContext
public javax.xml.namespace.NamespaceContext getNamespaceContext()
Gets a read-only namespace context. If no context is available this method will return an empty namespace context. The NamespaceContext contains information about all namespaces in scope for this StartElement.- Specified by:
getNamespaceContextin interfacejavax.xml.stream.events.StartElement- Returns:
- the current namespace context
-
setName
public void setName(javax.xml.namespace.QName qname)
-
getNamespace
public java.lang.String getNamespace()
-
getNamespaceURI
public java.lang.String getNamespaceURI(java.lang.String prefix)
Gets the value that the prefix is bound to in the context of this element. Returns null if the prefix is not bound in this context- Specified by:
getNamespaceURIin interfacejavax.xml.stream.events.StartElement- Parameters:
prefix- the prefix to lookup- Returns:
- the uri bound to the prefix or null
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
nameAsString
public java.lang.String nameAsString()
Return this event as String- Returns:
- String Event returned as string.
-
setNamespaceContext
public void setNamespaceContext(javax.xml.namespace.NamespaceContext context)
-
addAttribute
public void addAttribute(javax.xml.stream.events.Attribute attr)
-
addAttributes
public final void addAttributes(java.util.Iterator<? extends javax.xml.stream.events.Attribute> attrs)
-
addNamespace
public void addNamespace(javax.xml.stream.events.Namespace namespace)
-
addNamespaces
public final void addNamespaces(java.util.Iterator<? extends javax.xml.stream.events.Namespace> namespaces)
-
-