Class CdataMatcher


  • public class CdataMatcher
    extends Object
    CdataMatcher maintains a constraint to check which an opening tag introduces: a tag's cdata matches constraints set by it's cdata spec. Unfortunately we need to defer such checking and can't handle it while the opening tag is being processed.
    Author:
    nhant01, GeorgeLuo
    • Constructor Detail

      • CdataMatcher

        public CdataMatcher​(@Nonnull
                            ParsedTagSpec parsedTagSpec,
                            @Nonnull
                            Locator lineCol)
        Constructor.
        Parameters:
        parsedTagSpec - the ParsedTagSpec.
        lineCol - a line / column pair.
    • Method Detail

      • matchCss

        public int matchCss​(@Nonnull
                            String cdata,
                            @Nonnull
                            dev.amp.validator.ValidatorProtos.CssSpec cssSpec,
                            @Nonnull
                            Context context,
                            @Nonnull
                            dev.amp.validator.ValidatorProtos.ValidationResult.Builder validationResult)
                     throws CssValidationException,
                            IOException
        Matches the provided cdata against a CSS specification. Helper routine for match (see above). The return value is the number of bytes in the CSS string which were measured as URLs. In some validation types, these bytes are not counted against byte limits.
        Parameters:
        cdata - the cdata.
        cssSpec - CSS specification.
        context - the context object.
        validationResult - validation result.
        Returns:
        returns 1 if css matches against a CSS spec.
        Throws:
        CssValidationException - css validation exception.
        IOException - IO validation exception.
      • getLineCol

        public Locator getLineCol()
        Returns:
        lineCol of CdataMatcher
      • getTagSpec

        public dev.amp.validator.ValidatorProtos.TagSpec getTagSpec()
        Returns:
        tagspec of the CdataMatcher