Class Driver

    • Field Detail

      • reader

        private java.io.Reader reader
        The input UTF-16 code unit stream. If a byte stream was given, this object is an instance of HtmlInputStreamReader.
      • rewindableInputStream

        private RewindableInputStream rewindableInputStream
        The reference to the rewindable byte stream. null if p rohibited or no longer needed.
      • swallowBom

        private boolean swallowBom
      • characterEncoding

        private Encoding characterEncoding
      • allowRewinding

        private boolean allowRewinding
      • tokenizer

        private final Tokenizer tokenizer
      • characterHandlers

        private CharacterHandler[] characterHandlers
        Used for NFC checking if non-null, source code capture, etc.
    • Constructor Detail

      • Driver

        public Driver​(Tokenizer tokenizer)
    • Method Detail

      • isAllowRewinding

        public boolean isAllowRewinding()
        Returns the allowRewinding.
        Returns:
        the allowRewinding
      • setAllowRewinding

        public void setAllowRewinding​(boolean allowRewinding)
        Sets the allowRewinding.
        Parameters:
        allowRewinding - the allowRewinding to set
      • setCheckingNormalization

        public void setCheckingNormalization​(boolean enable)
        Turns NFC checking on or off.
        Parameters:
        enable - true if checking on
      • addCharacterHandler

        public void addCharacterHandler​(CharacterHandler characterHandler)
      • isCheckingNormalization

        public boolean isCheckingNormalization()
        Query if checking normalization.
        Returns:
        true if checking on
      • tokenize

        public void tokenize​(org.xml.sax.InputSource is)
                      throws org.xml.sax.SAXException,
                             java.io.IOException
        Runs the tokenization. This is the main entry point.
        Parameters:
        is - the input source
        Throws:
        org.xml.sax.SAXException - on fatal error (if configured to treat XML violations as fatal) or if the token handler threw
        java.io.IOException - if the stream threw
      • dontSwallowBom

        void dontSwallowBom()
      • runStates

        private void runStates()
                        throws org.xml.sax.SAXException,
                               java.io.IOException
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • internalEncodingDeclaration

        public boolean internalEncodingDeclaration​(java.lang.String internalCharset)
                                            throws org.xml.sax.SAXException
        Description copied from interface: EncodingDeclarationHandler
        Indicates that the parser has found an internal encoding declaration with the charset value charset.
        Specified by:
        internalEncodingDeclaration in interface EncodingDeclarationHandler
        Parameters:
        internalCharset - the charset name found.
        Returns:
        true if the value of charset was an encoding name for a supported ASCII-superset encoding.
        Throws:
        org.xml.sax.SAXException - if something went wrong
      • becomeConfident

        private void becomeConfident()
      • setHeuristics

        public void setHeuristics​(Heuristics heuristics)
        Sets the encoding sniffing heuristics.
        Parameters:
        heuristics - the heuristics to set
      • warnWithoutLocation

        protected void warnWithoutLocation​(java.lang.String message)
                                    throws org.xml.sax.SAXException
        Reports a warning without line/col
        Parameters:
        message - the message
        Throws:
        org.xml.sax.SAXException
      • encodingFromExternalDeclaration

        protected Encoding encodingFromExternalDeclaration​(java.lang.String encoding)
                                                    throws org.xml.sax.SAXException
        Initializes a decoder from external decl.
        Throws:
        org.xml.sax.SAXException
      • whineAboutEncodingAndReturnActual

        protected Encoding whineAboutEncodingAndReturnActual​(java.lang.String encoding,
                                                             Encoding cs)
                                                      throws org.xml.sax.SAXException
        Parameters:
        encoding -
        cs -
        Returns:
        Throws:
        org.xml.sax.SAXException
      • notifyAboutMetaBoundary

        void notifyAboutMetaBoundary()
      • setTransitionHandler

        public void setTransitionHandler​(TransitionHandler transitionHandler)
      • getCharacterEncoding

        public java.lang.String getCharacterEncoding()
                                              throws org.xml.sax.SAXException
        Description copied from interface: EncodingDeclarationHandler
        Queries the environment for the encoding in use (for error reporting).
        Specified by:
        getCharacterEncoding in interface EncodingDeclarationHandler
        Returns:
        the encoding in use
        Throws:
        org.xml.sax.SAXException - if something went wrong
      • getDocumentLocator

        public org.xml.sax.Locator getDocumentLocator()