Class 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.Location

    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

      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.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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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:
        toString in class java.lang.Object
      • 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 interface javax.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.Location
        Return the column number where the current event ends, returns -1 if none is available.
        Specified by:
        getColumnNumber in interface javax.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.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 interface javax.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.XMLEvent
        Returns an integer code for this event.
        Specified by:
        getEventType in interface javax.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.Attribute
        Returns the QName for this attribute
        Specified by:
        getName in interface javax.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.Attribute
        Gets the normalized value of this attribute
        Specified by:
        getValue in interface javax.xml.stream.events.Attribute
      • getDTDType

        public java.lang.String 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 interface javax.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:
        isSpecified in interface javax.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.XMLEvent
        A utility function to check if this event is a StartElement.
        Specified by:
        isStartElement in interface javax.xml.stream.events.XMLEvent
        See Also:
        StartElement
      • 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 interface javax.xml.stream.events.XMLEvent
        See Also:
        EndElement
      • 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 interface javax.xml.stream.events.XMLEvent
        See Also:
        EntityReference
      • 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 interface javax.xml.stream.events.XMLEvent
        See Also:
        ProcessingInstruction
      • 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 interface javax.xml.stream.events.XMLEvent
        See Also:
        Characters
      • 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 interface javax.xml.stream.events.XMLEvent
        See Also:
        Attribute
      • 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 interface javax.xml.stream.events.XMLEvent
        See Also:
        Namespace
      • 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 interface javax.xml.stream.events.XMLEvent
        See Also:
        StartDocument
      • 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 interface javax.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.Location
        Returns the public ID of the XML
        Specified by:
        getPublicId in interface javax.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.Location
        Returns the system ID of the XML
        Specified by:
        getSystemId in interface javax.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.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 interface javax.xml.stream.events.XMLEvent
        See Also:
        Location
      • asStartElement

        public javax.xml.stream.events.StartElement 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 interface javax.xml.stream.events.XMLEvent
      • asEndElement

        public javax.xml.stream.events.EndElement 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 interface javax.xml.stream.events.XMLEvent
      • asCharacters

        public javax.xml.stream.events.Characters 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 interface javax.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.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 interface javax.xml.stream.events.XMLEvent
      • writeAsEncodedUnicode

        public void writeAsEncodedUnicode​(java.io.Writer writer)
                                   throws javax.xml.stream.XMLStreamException
        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 interface javax.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