Top Description Fields Constructors Methods
org.codehaus.stax2.ri.evt

public Class StartElementEventImpl

extends BaseEventImpl
implements StartElement
Class Inheritance
All Implemented Interfaces
javax.xml.stream.events.StartElement, javax.xml.stream.events.XMLEvent, javax.xml.stream.XMLStreamConstants
Imports
java.io.IOException, .Writer, java.util.*, javax.xml.namespace.NamespaceContext, .QName, javax.xml.stream.*, javax.xml.stream.events.Attribute, .Namespace, .StartElement, org.codehaus.stax2.XMLStreamWriter2, org.codehaus.stax2.ri.EmptyIterator, .EmptyNamespaceContext

Wstx StartElement implementation used when event is constructed from already objectified data, for example when constructed by the event factory.

Field Summary

Modifier and TypeField and Description
pack-priv NamespaceContext
protected final ArrayList<Attribute>
protected final QName
protected final ArrayList<Namespace>
protected NamespaceContext
_parentNsCtxt

Enclosing namespace context

Inherited from org.codehaus.stax2.ri.evt.BaseEventImpl:
mLocation

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public StartElement
asStartElement()

Overrides org.codehaus.stax2.ri.evt.BaseEventImpl.asStartElement.

Implements javax.xml.stream.events.XMLEvent.asStartElement.

Returns this event as a start element event, may result in a class cast exception if this event is not a start element.
public static StartElementEventImpl
construct(Location loc, QName name, Iterator<?> attrIt, Iterator<?> nsDeclIt, NamespaceContext nsCtxt)

public boolean
equals(Object
the reference object with which to compare.
o
)

Implements abstract org.codehaus.stax2.ri.evt.BaseEventImpl.equals.

Declared abstract to force redefinition by sub-classes
public Attribute
getAttributeByName(QName
the qname of the desired attribute
nameIn
)

Implements javax.xml.stream.events.StartElement.getAttributeByName.

Returns the attribute referred to by the qname.
public Iterator<Attribute>
getAttributes()

Implements javax.xml.stream.events.StartElement.getAttributes.

Returns an Iterator of non-namespace attributes declared on this START_ELEMENT.
public int
getEventType()

Implements abstract org.codehaus.stax2.ri.evt.BaseEventImpl.getEventType.

Implements javax.xml.stream.events.XMLEvent.getEventType.

Returns an integer code for this event.
public final QName
getName()

Implements javax.xml.stream.events.StartElement.getName.

Get the name of this event
public NamespaceContext
getNamespaceContext()

Implements javax.xml.stream.events.StartElement.getNamespaceContext.

Gets a read-only namespace context.
public Iterator<Namespace>
getNamespaces()

Implements javax.xml.stream.events.StartElement.getNamespaces.

Returns an Iterator of namespaces declared on this element.
public String
getNamespaceURI(String
the prefix to lookup
prefix
)

Implements javax.xml.stream.events.StartElement.getNamespaceURI.

Gets the value that the prefix is bound to in the context of this element.
public int
hashCode()

Implements abstract org.codehaus.stax2.ri.evt.BaseEventImpl.hashCode.

Declared abstract to force redefinition by sub-classes
public boolean
isStartElement()

Overrides org.codehaus.stax2.ri.evt.BaseEventImpl.isStartElement.

Implements javax.xml.stream.events.XMLEvent.isStartElement.

A utility function to check if this event is a StartElement.
public void
writeAsEncodedUnicode(Writer
The writer that will output the data
w
)

Implements abstract org.codehaus.stax2.ri.evt.BaseEventImpl.writeAsEncodedUnicode.

Implements javax.xml.stream.events.XMLEvent.writeAsEncodedUnicode.

This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
public void
Inherited from org.codehaus.stax2.ri.evt.BaseEventImpl:
addHashasCharactersasEndElementgetLocationgetSchemaTypeisAttributeisCharactersisEndDocumentisEndElementisEntityReferenceisNamespaceisProcessingInstructionisStartDocumentiteratedEqualsstringsWithNullsEqualthrowFromIOEtoString

Field Detail

_actualNsCtxtback to summary
pack-priv NamespaceContext _actualNsCtxt
_attrsback to summary
protected final ArrayList<Attribute> _attrs
_nameback to summary
protected final QName _name
_nsDeclsback to summary
protected final ArrayList<Namespace> _nsDecls
_parentNsCtxtback to summary
protected NamespaceContext _parentNsCtxt

Enclosing namespace context

Constructor Detail

StartElementEventImplback to summary
protected StartElementEventImpl(Location loc, QName name, ArrayList<Attribute> attrs, ArrayList<Namespace> nsDecls, NamespaceContext parentNsCtxt)

Method Detail

asStartElementback to summary
public StartElement asStartElement()

Overrides org.codehaus.stax2.ri.evt.BaseEventImpl.asStartElement.

Implements javax.xml.stream.events.XMLEvent.asStartElement.

Doc from javax.xml.stream.events.XMLEvent.asStartElement.

Returns this event as a start element event, may result in a class cast exception if this event is not a start element.

Returns:StartElement

a StartElement event

Annotations
@Override
constructback to summary
public static StartElementEventImpl construct(Location loc, QName name, Iterator<?> attrIt, Iterator<?> nsDeclIt, NamespaceContext nsCtxt)
equalsback to summary
public boolean equals(Object o)

Implements abstract org.codehaus.stax2.ri.evt.BaseEventImpl.equals.

Doc from org.codehaus.stax2.ri.evt.BaseEventImpl.equals.

Declared abstract to force redefinition by sub-classes

Parameters
o:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAttributeByNameback to summary
public Attribute getAttributeByName(QName nameIn)

Implements javax.xml.stream.events.StartElement.getAttributeByName.

Doc from javax.xml.stream.events.StartElement.getAttributeByName.

Returns the attribute referred to by the qname.

Parameters
nameIn:QName

the qname of the desired attribute

Returns:Attribute

the attribute corresponding to the name value or null

Annotations
@Override
getAttributesback to summary
public Iterator<Attribute> getAttributes()

Implements javax.xml.stream.events.StartElement.getAttributes.

Doc from javax.xml.stream.events.StartElement.getAttributes.

Returns an Iterator of non-namespace attributes declared on this START_ELEMENT. Returns an empty iterator if there are no attributes. The iterator must contain only implementations of the Attribute interface. Attributes are fundamentally unordered and may be reported in any order.

Returns:Iterator<Attribute>

a readonly Iterator over Attribute interfaces, or an empty iterator

Annotations
@Override
getEventTypeback to summary
public int getEventType()

Implements abstract org.codehaus.stax2.ri.evt.BaseEventImpl.getEventType.

Implements javax.xml.stream.events.XMLEvent.getEventType.

Doc from javax.xml.stream.events.XMLEvent.getEventType.

Returns an integer code for this event.

Returns:int

the event type

Annotations
@Override
getNameback to summary
public final QName getName()

Implements javax.xml.stream.events.StartElement.getName.

Doc from javax.xml.stream.events.StartElement.getName.

Get the name of this event

Returns:QName

the qualified name of this event

Annotations
@Override
getNamespaceContextback to summary
public NamespaceContext getNamespaceContext()

Implements javax.xml.stream.events.StartElement.getNamespaceContext.

Doc from javax.xml.stream.events.StartElement.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.

Returns:NamespaceContext

the current namespace context

Annotations
@Override
getNamespacesback to summary
public Iterator<Namespace> getNamespaces()

Implements javax.xml.stream.events.StartElement.getNamespaces.

Doc from javax.xml.stream.events.StartElement.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 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. Returns an empty iterator if there are no namespaces.

Returns:Iterator<Namespace>

a readonly Iterator over Namespace interfaces, or an empty iterator

Annotations
@Override
getNamespaceURIback to summary
public String getNamespaceURI(String prefix)

Implements javax.xml.stream.events.StartElement.getNamespaceURI.

Doc from javax.xml.stream.events.StartElement.getNamespaceURI.

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

Parameters
prefix:String

the prefix to lookup

Returns:String

the uri bound to the prefix or null

Annotations
@Override
hashCodeback to summary
public int hashCode()

Implements abstract org.codehaus.stax2.ri.evt.BaseEventImpl.hashCode.

Doc from org.codehaus.stax2.ri.evt.BaseEventImpl.hashCode.

Declared abstract to force redefinition by sub-classes

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object.

Annotations
@Override
isStartElementback to summary
public boolean isStartElement()

Overrides org.codehaus.stax2.ri.evt.BaseEventImpl.isStartElement.

Implements javax.xml.stream.events.XMLEvent.isStartElement.

Doc from javax.xml.stream.events.XMLEvent.isStartElement.

A utility function to check if this event is a StartElement.

Returns:boolean

true if the event is StartElement, false otherwise

Annotations
@Override
writeAsEncodedUnicodeback to summary
public void writeAsEncodedUnicode(Writer w) throws XMLStreamException

Implements abstract org.codehaus.stax2.ri.evt.BaseEventImpl.writeAsEncodedUnicode.

Implements javax.xml.stream.events.XMLEvent.writeAsEncodedUnicode.

Doc from javax.xml.stream.events.XMLEvent.writeAsEncodedUnicode.

This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters. No indentation or whitespace should be outputted. Any user defined event type SHALL have this method called when being written to on an output stream. Built in Event types MUST implement this method, but implementations MAY choose not call these methods for optimizations reasons when writing out built in Events to an output stream. The output generated MUST be equivalent in terms of the infoset expressed.

Parameters
w:Writer

The writer that will output the data

Annotations
@Override
Exceptions
XMLStreamException:
if there is a fatal error writing the event
writeUsingback to summary
public void writeUsing(XMLStreamWriter2 sw) throws XMLStreamException

Implements abstract org.codehaus.stax2.ri.evt.BaseEventImpl.writeUsing.

Implements org.codehaus.stax2.evt.XMLEvent2.writeUsing.

Annotations
@Override