Package com.bea.xml.stream
Class AttributeBase
- java.lang.Object
-
- com.bea.xml.stream.AttributeBase
-
- All Implemented Interfaces:
javax.xml.stream.events.Attribute,javax.xml.stream.events.XMLEvent,javax.xml.stream.Location,javax.xml.stream.XMLStreamConstants
- Direct Known Subclasses:
NamespaceBase
public class AttributeBase extends java.lang.Object implements javax.xml.stream.events.Attribute, javax.xml.stream.LocationAn implementation of the Attribute class.
-
-
Constructor Summary
Constructors Constructor Description 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)AttributeBase(javax.xml.namespace.QName name, java.lang.String value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.stream.events.CharactersasCharacters()Returns this event as Characters, may result in a class cast exception if this event is not Characters.javax.xml.stream.events.EndElementasEndElement()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.StartElementasStartElement()Returns this event as a start element event, may result in a class cast exception if this event is not a start element.intgetCharacterOffset()Return the byte or character offset into the input source this location is pointing to.intgetColumnNumber()Return the column number where the current event ends, returns -1 if none is available.java.lang.StringgetDTDType()Gets the type of this attribute, default is the String "CDATA"intgetEventType()Returns an integer code for this event.intgetLineNumber()Return the line number where the current event ends, returns -1 if none is available.java.lang.StringgetLocalName()javax.xml.stream.LocationgetLocation()Return the location of this event.java.lang.StringgetLocationURI()javax.xml.namespace.QNamegetName()Returns the QName for this attributejava.lang.StringgetNamespaceURI()java.lang.StringgetPublicId()Returns the public ID of the XMLjavax.xml.namespace.QNamegetSchemaType()This method is provided for implementations to provide optional type information about the associated event.java.lang.StringgetSourceName()java.lang.StringgetSystemId()Returns the system ID of the XMLjava.lang.StringgetValue()Gets the normalized value of this attributebooleanhasName()booleanisAttribute()A utility function to check if this event is an Attribute.booleanisCharacters()A utility function to check if this event is Characters.booleanisDefault()booleanisEndDocument()A utility function to check if this event is an EndDocument.booleanisEndElement()A utility function to check if this event is a EndElement.booleanisEndEntity()booleanisEntityReference()A utility function to check if this event is an EntityReference.booleanisNamespace()A utility function to check if this event is a Namespace.booleanisNamespaceDeclaration()booleanisProcessingInstruction()A utility function to check if this event is a ProcessingInstruction.booleanisSpecified()By default, all attributes are created as specified since RI doesn't handle attribute defaulting.booleanisStartDocument()A utility function to check if this event is a StartDocument.booleanisStartElement()A utility function to check if this event is a StartElement.booleanisStartEntity()voidrecycle()voidsetCharacterOffset(int c)voidsetColumnNumber(int col)voidsetLineNumber(int line)voidsetLocationURI(java.lang.String uri)voidsetNamespaceURI(java.lang.String uri)java.lang.StringtoString()voidwriteAsEncodedUnicode(java.io.Writer writer)This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.static voidwriteEncodedChar(java.io.Writer writer, char c)
-
-
-
Constructor Detail
-
AttributeBase
public AttributeBase(java.lang.String prefix, java.lang.String namespaceURI, java.lang.String localName, java.lang.String value, java.lang.String attributeType)
-
AttributeBase
public AttributeBase(java.lang.String prefix, java.lang.String localName, java.lang.String value)
-
AttributeBase
public AttributeBase(javax.xml.namespace.QName name, java.lang.String value)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getLineNumber
public int getLineNumber()
Description copied from interface:javax.xml.stream.LocationReturn the line number where the current event ends, returns -1 if none is available.- Specified by:
getLineNumberin interfacejavax.xml.stream.Location- Returns:
- the current line number
-
setLineNumber
public void setLineNumber(int line)
-
getColumnNumber
public int getColumnNumber()
Description copied from interface:javax.xml.stream.LocationReturn the column number where the current event ends, returns -1 if none is available.- Specified by:
getColumnNumberin interfacejavax.xml.stream.Location- Returns:
- the current column number
-
setColumnNumber
public void setColumnNumber(int col)
-
getCharacterOffset
public int getCharacterOffset()
Description copied from interface:javax.xml.stream.LocationReturn 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:
getCharacterOffsetin interfacejavax.xml.stream.Location- Returns:
- the current offset
-
setCharacterOffset
public void setCharacterOffset(int c)
-
getLocationURI
public java.lang.String getLocationURI()
-
setLocationURI
public void setLocationURI(java.lang.String uri)
-
getEventType
public int getEventType()
Description copied from interface:javax.xml.stream.events.XMLEventReturns an integer code for this event.- Specified by:
getEventTypein interfacejavax.xml.stream.events.XMLEvent- See Also:
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
-
hasName
public boolean hasName()
-
getName
public javax.xml.namespace.QName getName()
Description copied from interface:javax.xml.stream.events.AttributeReturns the QName for this attribute- Specified by:
getNamein interfacejavax.xml.stream.events.Attribute
-
isNamespaceDeclaration
public boolean isNamespaceDeclaration()
-
getLocalName
public java.lang.String getLocalName()
-
getValue
public java.lang.String getValue()
Description copied from interface:javax.xml.stream.events.AttributeGets the normalized value of this attribute- Specified by:
getValuein interfacejavax.xml.stream.events.Attribute
-
getDTDType
public java.lang.String getDTDType()
Description copied from interface:javax.xml.stream.events.AttributeGets the type of this attribute, default is the String "CDATA"- Specified by:
getDTDTypein interfacejavax.xml.stream.events.Attribute- Returns:
- the type as a String, default is "CDATA"
-
getNamespaceURI
public java.lang.String getNamespaceURI()
-
setNamespaceURI
public void setNamespaceURI(java.lang.String uri)
-
isSpecified
public boolean isSpecified()
By default, all attributes are created as specified since RI doesn't handle attribute defaulting.- Specified by:
isSpecifiedin interfacejavax.xml.stream.events.Attribute- Returns:
- returns true if this was specified in the start element
-
isStartElement
public boolean isStartElement()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is a StartElement.- Specified by:
isStartElementin interfacejavax.xml.stream.events.XMLEvent- See Also:
StartElement
-
isEndElement
public boolean isEndElement()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is a EndElement.- Specified by:
isEndElementin interfacejavax.xml.stream.events.XMLEvent- See Also:
EndElement
-
isEntityReference
public boolean isEntityReference()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is an EntityReference.- Specified by:
isEntityReferencein interfacejavax.xml.stream.events.XMLEvent- See Also:
EntityReference
-
isProcessingInstruction
public boolean isProcessingInstruction()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is a ProcessingInstruction.- Specified by:
isProcessingInstructionin interfacejavax.xml.stream.events.XMLEvent- See Also:
ProcessingInstruction
-
isCharacters
public boolean isCharacters()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is Characters.- Specified by:
isCharactersin interfacejavax.xml.stream.events.XMLEvent- See Also:
Characters
-
isAttribute
public boolean isAttribute()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is an Attribute.- Specified by:
isAttributein interfacejavax.xml.stream.events.XMLEvent- See Also:
Attribute
-
isNamespace
public boolean isNamespace()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is a Namespace.- Specified by:
isNamespacein interfacejavax.xml.stream.events.XMLEvent- See Also:
Namespace
-
isStartDocument
public boolean isStartDocument()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is a StartDocument.- Specified by:
isStartDocumentin interfacejavax.xml.stream.events.XMLEvent- See Also:
StartDocument
-
isEndDocument
public boolean isEndDocument()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is an EndDocument.- Specified by:
isEndDocumentin interfacejavax.xml.stream.events.XMLEvent- See Also:
EndDocument
-
isEndEntity
public boolean isEndEntity()
-
isStartEntity
public boolean isStartEntity()
-
getPublicId
public java.lang.String getPublicId()
Description copied from interface:javax.xml.stream.LocationReturns the public ID of the XML- Specified by:
getPublicIdin interfacejavax.xml.stream.Location- Returns:
- the public ID, or null if not available
-
getSystemId
public java.lang.String getSystemId()
Description copied from interface:javax.xml.stream.LocationReturns the system ID of the XML- Specified by:
getSystemIdin interfacejavax.xml.stream.Location- Returns:
- the system ID, or null if not available
-
getLocation
public javax.xml.stream.Location getLocation()
Description copied from interface:javax.xml.stream.events.XMLEventReturn the location of this event. The Location returned from this method is non-volatile and will retain its information.- Specified by:
getLocationin interfacejavax.xml.stream.events.XMLEvent- See Also:
Location
-
asStartElement
public javax.xml.stream.events.StartElement asStartElement()
Description copied from interface:javax.xml.stream.events.XMLEventReturns this event as a start element event, may result in a class cast exception if this event is not a start element.- Specified by:
asStartElementin interfacejavax.xml.stream.events.XMLEvent
-
asEndElement
public javax.xml.stream.events.EndElement asEndElement()
Description copied from interface:javax.xml.stream.events.XMLEventReturns this event as an end element event, may result in a class cast exception if this event is not a end element.- Specified by:
asEndElementin interfacejavax.xml.stream.events.XMLEvent
-
asCharacters
public javax.xml.stream.events.Characters asCharacters()
Description copied from interface:javax.xml.stream.events.XMLEventReturns this event as Characters, may result in a class cast exception if this event is not Characters.- Specified by:
asCharactersin interfacejavax.xml.stream.events.XMLEvent
-
recycle
public void recycle()
-
isDefault
public boolean isDefault()
-
getSourceName
public java.lang.String getSourceName()
-
getSchemaType
public javax.xml.namespace.QName getSchemaType()
Description copied from interface:javax.xml.stream.events.XMLEventThis 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:
getSchemaTypein interfacejavax.xml.stream.events.XMLEvent
-
writeAsEncodedUnicode
public void writeAsEncodedUnicode(java.io.Writer writer) throws javax.xml.stream.XMLStreamExceptionDescription copied from interface:javax.xml.stream.events.XMLEventThis 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:
writeAsEncodedUnicodein interfacejavax.xml.stream.events.XMLEvent- Parameters:
writer- The writer that will output the data- Throws:
javax.xml.stream.XMLStreamException
-
writeEncodedChar
public static void writeEncodedChar(java.io.Writer writer, char c) throws java.io.IOException- Throws:
java.io.IOException
-
-