Class AMPHtmlHandler

    • Constructor Detail

      • AMPHtmlHandler

        public AMPHtmlHandler​(@Nonnull
                              AMPValidatorManager validatorManager,
                              @Nonnull
                              dev.amp.validator.ValidatorProtos.HtmlFormat.Code htmlFormat,
                              @Nonnull
                              ExitCondition condition,
                              int maxNodesAllowed)
        Creates an AMPHtmlHandler.
        Parameters:
        validatorManager - the validator manager instance.
        htmlFormat - HtmlFormat code.
        condition - exit condition.
        maxNodesAllowed - max nodes allowed.
    • Method Detail

      • startElement

        public void startElement​(String uri,
                                 String localName,
                                 String qName,
                                 Attributes attributes)
                          throws SAXException
        Processing the start of an element.
        Specified by:
        startElement in interface ContentHandler
        Overrides:
        startElement in class DefaultHandler
        Parameters:
        uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
        localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
        qName - The qualified name (with prefix), or the empty string if qualified names are not available.
        attributes - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
        Throws:
        SAXException - Any SAX exception
      • endElement

        public void endElement​(String uri,
                               String localName,
                               String qName)
        Processing the end of an element.
        Specified by:
        endElement in interface ContentHandler
        Overrides:
        endElement in class DefaultHandler
        Parameters:
        uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
        localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
        qName - The qualified name (with prefix), or the empty string if qualified names are not available.
      • validationResult

        public dev.amp.validator.ValidatorProtos.ValidationResult.Builder validationResult()
        Returns the validation result.
        Returns:
        returns the validation result.
      • emitMissingExtensionErrors

        public void emitMissingExtensionErrors()
        While parsing the document HEAD, we may accumulate errors which depend on seeing later extension script tags.
      • characters

        public void characters​(char[] ch,
                               int start,
                               int length)
        Processing character data inside an element.
        Specified by:
        characters in interface ContentHandler
        Overrides:
        characters in class DefaultHandler
        Parameters:
        ch - The characters.
        start - The start position in the character array.
        length - The number of characters to use from the character array.