/// <summary> /// Constructs a instance of XML minification manager /// </summary> /// <param name="settings">XML minification settings</param> /// <param name="logger">Logger</param> public XmlMinificationManager(XmlMinificationSettings settings, ILogger logger) { MinificationSettings = settings; SupportedMediaTypes = new HashSet<string>(MediaTypeGroupConstants.Xml); IncludedPages = new List<IUrlMatcher>(); ExcludedPages = new List<IUrlMatcher>(); Logger = logger; }
/// <summary> /// Creates a instance of XML minifier based on the settings /// that specified in configuration files (App.config or Web.config) /// </summary> /// <param name="settings">XML minification settings</param> /// <param name="logger">logger</param> /// <returns>XML minifier</returns> public XmlMinifier CreateXmlMinifierInstance(XmlMinificationSettings settings = null, ILogger logger = null) { XmlMinificationSettings innerSettings = settings ?? GetXmlMinificationSettings(); ILogger innerLogger = logger ?? _wmmContext.GetDefaultLoggerInstance(); var xmlMinifier = new XmlMinifier(innerSettings, innerLogger); return(xmlMinifier); }
/// <summary> /// Gets a XML minification settings based on data from /// configuration files (App.config or Web.config) /// </summary> /// <returns>XML minification settings</returns> public XmlMinificationSettings GetXmlMinificationSettings() { XmlMinificationConfiguration xmlConfig = _wmmContext.GetCoreConfiguration().Xml; var xmlSettings = new XmlMinificationSettings { MinifyWhitespace = xmlConfig.MinifyWhitespace, RemoveXmlComments = xmlConfig.RemoveXmlComments, RenderEmptyTagsWithSpace = xmlConfig.RenderEmptyTagsWithSpace, CollapseTagsWithoutContent = xmlConfig.CollapseTagsWithoutContent }; return(xmlSettings); }
/// <summary> /// Constructs instance of XML minifier /// </summary> /// <param name="settings">XML minification settings</param> /// <param name="logger">Logger</param> public XmlMinifier(XmlMinificationSettings settings = null, ILogger logger = null) { _settings = settings ?? new XmlMinificationSettings(); _logger = logger ?? new NullLogger(); _xmlParser = new XmlParser(new XmlParsingHandlers { XmlDeclaration = XmlDeclarationHandler, ProcessingInstruction = ProcessingInstructionHandler, Doctype = DoctypeDelegateHandler, Comment = CommentHandler, CdataSection = CdataSectionHandler, StartTag = StartTagHandler, EndTag = EndTagHandler, EmptyTag = EmptyTagHandler, Text = TextHandler }); }
/// <summary> /// Constructs instance of XML minifier /// </summary> /// <param name="settings">XML minification settings</param> /// <param name="logger">Logger</param> public XmlMinifier(XmlMinificationSettings settings = null, ILogger logger = null) { _settings = settings ?? new XmlMinificationSettings(); _logger = logger ?? new NullLogger(); _xmlParser = new XmlParser(new XmlParsingHandlers { XmlDeclaration = XmlDeclarationHandler, ProcessingInstruction = ProcessingInstructionHandler, Doctype = DoctypeDelegateHandler, Comment = CommentHandler, CdataSection = CdataSectionHandler, StartTag = StartTagHandler, EndTag = EndTagHandler, EmptyTag = EmptyTagHandler, Text = TextHandler }); _buffer = new List <string>(); _errors = new List <MinificationErrorInfo>(); _currentNodeType = XmlNodeType.Unknown; _currentText = string.Empty; }
/// <summary> /// Minifies the XML content. /// </summary> /// <param name="useEmptyMinificationSettings"> /// Boolean to specify whether to use empty minification settings. /// Default value is <c>false</c>, this will use commonly accepted settings. /// </param> public MinifyXml(bool useEmptyMinificationSettings = false) { // https://github.com/Taritsyn/WebMarkupMin/wiki/XML-Minifier _minificationSettings = new XmlMinificationSettings(useEmptyMinificationSettings); }
/// <summary> /// Constructs instance of XML minifier /// </summary> /// <param name="settings">XML minification settings</param> /// <param name="logger">Logger</param> public XmlMinifier(XmlMinificationSettings settings = null, ILogger logger = null) { _settings = settings ?? new XmlMinificationSettings(); _logger = logger ?? new NullLogger(); _xmlParser = new XmlParser(new XmlParsingHandlers { XmlDeclaration = XmlDeclarationHandler, ProcessingInstruction = ProcessingInstructionHandler, Doctype = DoctypeDelegateHandler, Comment = CommentHandler, CdataSection = CdataSectionHandler, StartTag = StartTagHandler, EndTag = EndTagHandler, EmptyTag = EmptyTagHandler, Text = TextHandler, IgnoredFragment = IgnoredFragmentHandler }); _buffer = new List<string>(); _errors = new List<MinificationErrorInfo>(); _currentNodeType = XmlNodeType.Unknown; _currentText = string.Empty; }