/** * Read the CSS from the passed String using a character stream. An eventually * contained <code>@charset</code> rule is ignored. * * @param sCSS * The source string containing the CSS to be parsed. May not be * <code>null</code>. * @param eVersion * The CSS version to use. May not be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. * @since 3.7.3 */ @Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion) { return readFromStringReader (sCSS, new CSSReaderSettings ().setCSSVersion (eVersion)); }
/** * Read the CSS from the passed String using a character stream. An eventually * contained <code>@charset</code> rule is ignored. * * @param sCSS * The source string containing the CSS to be parsed. May not be * <code>null</code>. * @param eVersion * The CSS version to use. May not be <code>null</code>. * @param aCustomErrorHandler * An optional custom error handler that can be used to collect the * recoverable parsing errors. May be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. * @since 3.7.3 */ @Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseErrorHandler aCustomErrorHandler) { return readFromStringReader (sCSS, new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomErrorHandler (aCustomErrorHandler)); }
/** * Read the CSS from the passed String using a character stream. An eventually * contained <code>@charset</code> rule is ignored. * * @param sCSS * The source string containing the CSS to be parsed. May not be * <code>null</code>. * @param eVersion * The CSS version to use. May not be <code>null</code>. * @param aCustomExceptionHandler * An optional custom exception handler that can be used to collect the * unrecoverable parsing errors. May be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. * @since 3.7.3 */ @Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseExceptionCallback aCustomExceptionHandler) { return readFromStringReader (sCSS, new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomExceptionHandler (aCustomExceptionHandler)); }
/** * Read the CSS from the passed String using a character stream. An eventually * contained <code>@charset</code> rule is ignored. * * @param sCSS * The source string containing the CSS to be parsed. May not be * <code>null</code>. * @param eVersion * The CSS version to use. May not be <code>null</code>. * @param aCustomErrorHandler * An optional custom error handler that can be used to collect the * recoverable parsing errors. May be <code>null</code>. * @param aCustomExceptionHandler * An optional custom exception handler that can be used to collect the * unrecoverable parsing errors. May be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. * @since 3.7.3 */ @Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseErrorHandler aCustomErrorHandler, @Nullable final ICSSParseExceptionCallback aCustomExceptionHandler) { return readFromStringReader (sCSS, new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomErrorHandler (aCustomErrorHandler) .setCustomExceptionHandler (aCustomExceptionHandler)); }
.setInterpretErrorHandler(new DoNothingCSSInterpretErrorHandler()); final CascadingStyleSheet aCSS = CSSReader.readFromStringReader( cssContent, readerSettings);