Package com.bea.xml.stream
Class AttributeBase
java.lang.Object
com.bea.xml.stream.AttributeBase
- All Implemented Interfaces:
Attribute
,XMLEvent
,Location
,XMLStreamConstants
- Direct Known Subclasses:
NamespaceBase
An implementation of the Attribute class.
-
Field Summary
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
-
Constructor Summary
ConstructorsConstructorDescriptionAttributeBase
(String prefix, String localName, String value) AttributeBase
(String prefix, String namespaceURI, String localName, String value, String attributeType) AttributeBase
(QName name, String value) -
Method Summary
Modifier and TypeMethodDescriptionReturns this event as Characters, may result in a class cast exception if this event is not Characters.Returns this event as an end element event, may result in a class cast exception if this event is not a end element.Returns this event as a start element event, may result in a class cast exception if this event is not a start element.int
Return the byte or character offset into the input source this location is pointing to.int
Return the column number where the current event ends, returns -1 if none is available.Gets the type of this attribute, default is the String "CDATA"int
Returns an integer code for this event.int
Return the line number where the current event ends, returns -1 if none is available.Return the location of this event.getName()
Returns the QName for this attributeReturns the public ID of the XMLThis method is provided for implementations to provide optional type information about the associated event.Returns the system ID of the XMLgetValue()
Gets the normalized value of this attributeboolean
hasName()
boolean
A utility function to check if this event is an Attribute.boolean
A utility function to check if this event is Characters.boolean
boolean
A utility function to check if this event is an EndDocument.boolean
A utility function to check if this event is a EndElement.boolean
boolean
A utility function to check if this event is an EntityReference.boolean
A utility function to check if this event is a Namespace.boolean
boolean
A utility function to check if this event is a ProcessingInstruction.boolean
By default, all attributes are created as specified since RI doesn't handle attribute defaulting.boolean
A utility function to check if this event is a StartDocument.boolean
A utility function to check if this event is a StartElement.boolean
void
recycle()
void
setCharacterOffset
(int c) void
setColumnNumber
(int col) void
setLineNumber
(int line) void
setLocationURI
(String uri) void
setNamespaceURI
(String uri) toString()
void
writeAsEncodedUnicode
(Writer writer) This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.static void
writeEncodedChar
(Writer writer, char c)
-
Constructor Details
-
AttributeBase
-
AttributeBase
-
AttributeBase
-
-
Method Details
-
toString
-
getLineNumber
public int getLineNumber()Description copied from interface:javax.xml.stream.Location
Return the line number where the current event ends, returns -1 if none is available.- Specified by:
getLineNumber
in interfaceLocation
- Returns:
- the current line number
-
setLineNumber
public void setLineNumber(int line) -
getColumnNumber
public int getColumnNumber()Description copied from interface:javax.xml.stream.Location
Return the column number where the current event ends, returns -1 if none is available.- Specified by:
getColumnNumber
in interfaceLocation
- Returns:
- the current column number
-
setColumnNumber
public void setColumnNumber(int col) -
getCharacterOffset
public int getCharacterOffset()Description copied from interface:javax.xml.stream.Location
Return the byte or character offset into the input source this location is pointing to. If the input source is a file or a byte stream then this is the byte offset into that stream, but if the input source is a character media then the offset is the character offset. Returns -1 if there is no offset available.- Specified by:
getCharacterOffset
in interfaceLocation
- Returns:
- the current offset
-
setCharacterOffset
public void setCharacterOffset(int c) -
getLocationURI
-
setLocationURI
-
getEventType
public int getEventType()Description copied from interface:javax.xml.stream.events.XMLEvent
Returns an integer code for this event.- Specified by:
getEventType
in interfaceXMLEvent
- See Also:
-
hasName
public boolean hasName() -
getName
Description copied from interface:javax.xml.stream.events.Attribute
Returns the QName for this attribute -
isNamespaceDeclaration
public boolean isNamespaceDeclaration() -
getLocalName
-
getValue
Description copied from interface:javax.xml.stream.events.Attribute
Gets the normalized value of this attribute -
getDTDType
Description copied from interface:javax.xml.stream.events.Attribute
Gets the type of this attribute, default is the String "CDATA"- Specified by:
getDTDType
in interfaceAttribute
- Returns:
- the type as a String, default is "CDATA"
-
getNamespaceURI
-
setNamespaceURI
-
isSpecified
public boolean isSpecified()By default, all attributes are created as specified since RI doesn't handle attribute defaulting.- Specified by:
isSpecified
in interfaceAttribute
- Returns:
- returns true if this was specified in the start element
-
isStartElement
public boolean isStartElement()Description copied from interface:javax.xml.stream.events.XMLEvent
A utility function to check if this event is a StartElement.- Specified by:
isStartElement
in interfaceXMLEvent
- See Also:
-
isEndElement
public boolean isEndElement()Description copied from interface:javax.xml.stream.events.XMLEvent
A utility function to check if this event is a EndElement.- Specified by:
isEndElement
in interfaceXMLEvent
- See Also:
-
isEntityReference
public boolean isEntityReference()Description copied from interface:javax.xml.stream.events.XMLEvent
A utility function to check if this event is an EntityReference.- Specified by:
isEntityReference
in interfaceXMLEvent
- See Also:
-
isProcessingInstruction
public boolean isProcessingInstruction()Description copied from interface:javax.xml.stream.events.XMLEvent
A utility function to check if this event is a ProcessingInstruction.- Specified by:
isProcessingInstruction
in interfaceXMLEvent
- See Also:
-
isCharacters
public boolean isCharacters()Description copied from interface:javax.xml.stream.events.XMLEvent
A utility function to check if this event is Characters.- Specified by:
isCharacters
in interfaceXMLEvent
- See Also:
-
isAttribute
public boolean isAttribute()Description copied from interface:javax.xml.stream.events.XMLEvent
A utility function to check if this event is an Attribute.- Specified by:
isAttribute
in interfaceXMLEvent
- See Also:
-
isNamespace
public boolean isNamespace()Description copied from interface:javax.xml.stream.events.XMLEvent
A utility function to check if this event is a Namespace.- Specified by:
isNamespace
in interfaceXMLEvent
- See Also:
-
isStartDocument
public boolean isStartDocument()Description copied from interface:javax.xml.stream.events.XMLEvent
A utility function to check if this event is a StartDocument.- Specified by:
isStartDocument
in interfaceXMLEvent
- See Also:
-
isEndDocument
public boolean isEndDocument()Description copied from interface:javax.xml.stream.events.XMLEvent
A utility function to check if this event is an EndDocument.- Specified by:
isEndDocument
in interfaceXMLEvent
- See Also:
-
isEndEntity
public boolean isEndEntity() -
isStartEntity
public boolean isStartEntity() -
getPublicId
Description copied from interface:javax.xml.stream.Location
Returns the public ID of the XML- Specified by:
getPublicId
in interfaceLocation
- Returns:
- the public ID, or null if not available
-
getSystemId
Description copied from interface:javax.xml.stream.Location
Returns the system ID of the XML- Specified by:
getSystemId
in interfaceLocation
- Returns:
- the system ID, or null if not available
-
getLocation
Description copied from interface:javax.xml.stream.events.XMLEvent
Return the location of this event. The Location returned from this method is non-volatile and will retain its information.- Specified by:
getLocation
in interfaceXMLEvent
- See Also:
-
asStartElement
Description copied from interface:javax.xml.stream.events.XMLEvent
Returns this event as a start element event, may result in a class cast exception if this event is not a start element.- Specified by:
asStartElement
in interfaceXMLEvent
-
asEndElement
Description copied from interface:javax.xml.stream.events.XMLEvent
Returns this event as an end element event, may result in a class cast exception if this event is not a end element.- Specified by:
asEndElement
in interfaceXMLEvent
-
asCharacters
Description copied from interface:javax.xml.stream.events.XMLEvent
Returns this event as Characters, may result in a class cast exception if this event is not Characters.- Specified by:
asCharacters
in interfaceXMLEvent
-
recycle
public void recycle() -
isDefault
public boolean isDefault() -
getSourceName
-
getSchemaType
Description copied from interface:javax.xml.stream.events.XMLEvent
This method is provided for implementations to provide optional type information about the associated event. It is optional and will return null if no information is available.- Specified by:
getSchemaType
in interfaceXMLEvent
-
writeAsEncodedUnicode
Description copied from interface:javax.xml.stream.events.XMLEvent
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.- Specified by:
writeAsEncodedUnicode
in interfaceXMLEvent
- Parameters:
writer
- The writer that will output the data- Throws:
XMLStreamException
-
writeEncodedChar
- Throws:
IOException
-