public class AttributeBase
extends java.lang.Object
implements javax.xml.stream.events.Attribute, javax.xml.stream.Location
An implementation of the Attribute class.
Constructor and Description |
---|
AttributeBase(javax.xml.namespace.QName name,
java.lang.String value) |
AttributeBase(java.lang.String prefix,
java.lang.String localName,
java.lang.String value) |
AttributeBase(java.lang.String prefix,
java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String value,
java.lang.String attributeType) |
Modifier and Type | Method and Description |
---|---|
javax.xml.stream.events.Characters |
asCharacters()
Returns this event as Characters, may result in
a class cast exception if this event is not Characters.
|
javax.xml.stream.events.EndElement |
asEndElement()
Returns this event as an end element event, may result in
a class cast exception if this event is not a end element.
|
javax.xml.stream.events.StartElement |
asStartElement()
Returns this event as a start element event, may result in
a class cast exception if this event is not a start element.
|
int |
getCharacterOffset()
Return the byte or character offset into the input source this location
is pointing to.
|
int |
getColumnNumber()
Return the column number where the current event ends,
returns -1 if none is available.
|
java.lang.String |
getDTDType()
Gets the type of this attribute, default is
the String "CDATA"
|
int |
getEventType()
Returns an integer code for this event.
|
int |
getLineNumber()
Return the line number where the current event ends,
returns -1 if none is available.
|
java.lang.String |
getLocalName() |
javax.xml.stream.Location |
getLocation()
Return the location of this event.
|
java.lang.String |
getLocationURI() |
javax.xml.namespace.QName |
getName()
Returns the QName for this attribute
|
java.lang.String |
getNamespaceURI() |
java.lang.String |
getPublicId()
Returns the public ID of the XML
|
javax.xml.namespace.QName |
getSchemaType()
This method is provided for implementations to provide
optional type information about the associated event.
|
java.lang.String |
getSourceName() |
java.lang.String |
getSystemId()
Returns the system ID of the XML
|
java.lang.String |
getValue()
Gets the normalized value of this attribute
|
boolean |
hasName() |
boolean |
isAttribute()
A utility function to check if this event is an Attribute.
|
boolean |
isCharacters()
A utility function to check if this event is Characters.
|
boolean |
isDefault() |
boolean |
isEndDocument()
A utility function to check if this event is an EndDocument.
|
boolean |
isEndElement()
A utility function to check if this event is a EndElement.
|
boolean |
isEndEntity() |
boolean |
isEntityReference()
A utility function to check if this event is an EntityReference.
|
boolean |
isNamespace()
A utility function to check if this event is a Namespace.
|
boolean |
isNamespaceDeclaration() |
boolean |
isProcessingInstruction()
A utility function to check if this event is a ProcessingInstruction.
|
boolean |
isSpecified()
By default, all attributes are created as specified since RI doesn't
handle attribute defaulting.
|
boolean |
isStartDocument()
A utility function to check if this event is a StartDocument.
|
boolean |
isStartElement()
A utility function to check if this event is a StartElement.
|
boolean |
isStartEntity() |
void |
recycle() |
void |
setCharacterOffset(int c) |
void |
setColumnNumber(int col) |
void |
setLineNumber(int line) |
void |
setLocationURI(java.lang.String uri) |
void |
setNamespaceURI(java.lang.String uri) |
java.lang.String |
toString() |
void |
writeAsEncodedUnicode(java.io.Writer writer)
This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
|
static void |
writeEncodedChar(java.io.Writer writer,
char c) |
public AttributeBase(java.lang.String prefix, java.lang.String namespaceURI, java.lang.String localName, java.lang.String value, java.lang.String attributeType)
public AttributeBase(java.lang.String prefix, java.lang.String localName, java.lang.String value)
public AttributeBase(javax.xml.namespace.QName name, java.lang.String value)
public java.lang.String toString()
toString
in class java.lang.Object
public int getLineNumber()
javax.xml.stream.Location
getLineNumber
in interface javax.xml.stream.Location
public void setLineNumber(int line)
public int getColumnNumber()
javax.xml.stream.Location
getColumnNumber
in interface javax.xml.stream.Location
public void setColumnNumber(int col)
public int getCharacterOffset()
javax.xml.stream.Location
getCharacterOffset
in interface javax.xml.stream.Location
public void setCharacterOffset(int c)
public java.lang.String getLocationURI()
public void setLocationURI(java.lang.String uri)
public int getEventType()
javax.xml.stream.events.XMLEvent
getEventType
in interface javax.xml.stream.events.XMLEvent
XMLStreamConstants.START_ELEMENT
,
XMLStreamConstants.END_ELEMENT
,
XMLStreamConstants.CHARACTERS
,
XMLStreamConstants.ATTRIBUTE
,
XMLStreamConstants.NAMESPACE
,
XMLStreamConstants.PROCESSING_INSTRUCTION
,
XMLStreamConstants.COMMENT
,
XMLStreamConstants.START_DOCUMENT
,
XMLStreamConstants.END_DOCUMENT
,
XMLStreamConstants.DTD
public boolean hasName()
public javax.xml.namespace.QName getName()
javax.xml.stream.events.Attribute
getName
in interface javax.xml.stream.events.Attribute
public boolean isNamespaceDeclaration()
public java.lang.String getLocalName()
public java.lang.String getValue()
javax.xml.stream.events.Attribute
getValue
in interface javax.xml.stream.events.Attribute
public java.lang.String getDTDType()
javax.xml.stream.events.Attribute
getDTDType
in interface javax.xml.stream.events.Attribute
public java.lang.String getNamespaceURI()
public void setNamespaceURI(java.lang.String uri)
public boolean isSpecified()
isSpecified
in interface javax.xml.stream.events.Attribute
public boolean isStartElement()
javax.xml.stream.events.XMLEvent
isStartElement
in interface javax.xml.stream.events.XMLEvent
StartElement
public boolean isEndElement()
javax.xml.stream.events.XMLEvent
isEndElement
in interface javax.xml.stream.events.XMLEvent
EndElement
public boolean isEntityReference()
javax.xml.stream.events.XMLEvent
isEntityReference
in interface javax.xml.stream.events.XMLEvent
EntityReference
public boolean isProcessingInstruction()
javax.xml.stream.events.XMLEvent
isProcessingInstruction
in interface javax.xml.stream.events.XMLEvent
ProcessingInstruction
public boolean isCharacters()
javax.xml.stream.events.XMLEvent
isCharacters
in interface javax.xml.stream.events.XMLEvent
Characters
public boolean isAttribute()
javax.xml.stream.events.XMLEvent
isAttribute
in interface javax.xml.stream.events.XMLEvent
Attribute
public boolean isNamespace()
javax.xml.stream.events.XMLEvent
isNamespace
in interface javax.xml.stream.events.XMLEvent
Namespace
public boolean isStartDocument()
javax.xml.stream.events.XMLEvent
isStartDocument
in interface javax.xml.stream.events.XMLEvent
StartDocument
public boolean isEndDocument()
javax.xml.stream.events.XMLEvent
isEndDocument
in interface javax.xml.stream.events.XMLEvent
EndDocument
public boolean isEndEntity()
public boolean isStartEntity()
public java.lang.String getPublicId()
javax.xml.stream.Location
getPublicId
in interface javax.xml.stream.Location
public java.lang.String getSystemId()
javax.xml.stream.Location
getSystemId
in interface javax.xml.stream.Location
public javax.xml.stream.Location getLocation()
javax.xml.stream.events.XMLEvent
getLocation
in interface javax.xml.stream.events.XMLEvent
Location
public javax.xml.stream.events.StartElement asStartElement()
javax.xml.stream.events.XMLEvent
asStartElement
in interface javax.xml.stream.events.XMLEvent
public javax.xml.stream.events.EndElement asEndElement()
javax.xml.stream.events.XMLEvent
asEndElement
in interface javax.xml.stream.events.XMLEvent
public javax.xml.stream.events.Characters asCharacters()
javax.xml.stream.events.XMLEvent
asCharacters
in interface javax.xml.stream.events.XMLEvent
public void recycle()
public boolean isDefault()
public java.lang.String getSourceName()
public javax.xml.namespace.QName getSchemaType()
javax.xml.stream.events.XMLEvent
getSchemaType
in interface javax.xml.stream.events.XMLEvent
public void writeAsEncodedUnicode(java.io.Writer writer) throws javax.xml.stream.XMLStreamException
javax.xml.stream.events.XMLEvent
writeAsEncodedUnicode
in interface javax.xml.stream.events.XMLEvent
writer
- The writer that will output the dataXMLStreamException
- if there is a fatal error writing the eventpublic static void writeEncodedChar(java.io.Writer writer, char c) throws java.io.IOException
java.io.IOException