Class StreamReader.Text

  • All Implemented Interfaces:
    java.lang.Iterable<Attribute>, EventNode
    Enclosing class:
    StreamReader

    private static class StreamReader.Text
    extends EventToken
    The Text object is used to represent a text event. If wraps a node that holds text consumed from the document. These are used by InputNode objects to extract the text values for elements For debugging this exposes the node.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.xml.stream.events.Characters text
      This is the event that is used to represent the text value.
    • Constructor Summary

      Constructors 
      Constructor Description
      Text​(javax.xml.stream.events.XMLEvent event)
      Constructor for the Text object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getSource()
      This is used to return the node for the text.
      java.lang.String getValue()
      This returns the value of the event.
      boolean isText()
      This is true as this event represents a text token.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • text

        private final javax.xml.stream.events.Characters text
        This is the event that is used to represent the text value.
    • Constructor Detail

      • Text

        public Text​(javax.xml.stream.events.XMLEvent event)
        Constructor for the Text object. This creates an event that provides text to the core reader. Text can be in the form of a CDATA section or a normal text entry.
        Parameters:
        event - this is the node that represents the text value
    • Method Detail

      • isText

        public boolean isText()
        This is true as this event represents a text token. Text tokens are required to provide a value only. So namespace details and the node name will always return null.
        Specified by:
        isText in interface EventNode
        Overrides:
        isText in class EventToken
        Returns:
        this returns true as this event represents text
      • getValue

        public java.lang.String getValue()
        This returns the value of the event. This will return the text value contained within the node. If there is no text within the node this should return an empty string.
        Specified by:
        getValue in interface EventNode
        Overrides:
        getValue in class EventToken
        Returns:
        this returns the value represented by this event
      • getSource

        public java.lang.Object getSource()
        This is used to return the node for the text. Because this represents a StAX event the StAX event is returned. Returning the node helps with certain debugging issues.
        Specified by:
        getSource in interface EventNode
        Overrides:
        getSource in class EventToken
        Returns:
        this will return the source object for this