private static bool CheckProperty(IDictionary <String, String> resolvedProps, String key) { if (!CssDeclarationValidationMaster.CheckDeclaration(new CssDeclaration(key, resolvedProps.Get(key)))) { LOGGER.Error(MessageFormatUtil.Format(iText.StyledXmlParser.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION , resolvedProps.Get(key))); return(false); } return(true); }
/// <summary>Puts a declaration in a styles map if the declaration is valid.</summary> /// <param name="stylesMap">the styles map</param> /// <param name="cssDeclaration">the css declaration</param> private static void PutDeclarationInMapIfValid(IDictionary <String, CssDeclaration> stylesMap, CssDeclaration cssDeclaration) { if (CssDeclarationValidationMaster.CheckDeclaration(cssDeclaration)) { stylesMap.Put(cssDeclaration.GetProperty(), cssDeclaration); } else { ILog logger = LogManager.GetLogger(typeof(ICssResolver)); logger.Warn(MessageFormatUtil.Format(iText.StyledXmlParser.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION , cssDeclaration)); } }
private static bool CheckProperties(IDictionary <CssBackgroundUtils.BackgroundPropertyType, String> resolvedProps ) { foreach (KeyValuePair <CssBackgroundUtils.BackgroundPropertyType, String> property in resolvedProps) { if (!CssDeclarationValidationMaster.CheckDeclaration(new CssDeclaration(CssBackgroundUtils.GetBackgroundPropertyNameFromType (property.Key), property.Value))) { LOGGER.Error(MessageFormatUtil.Format(iText.StyledXmlParser.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION , property.Value)); return(false); } IShorthandResolver resolver = ShorthandResolverFactory.GetShorthandResolver(CssBackgroundUtils.GetBackgroundPropertyNameFromType (property.Key)); if (resolver != null && resolver.ResolveShorthand(property.Value).IsEmpty()) { return(false); } } return(true); }