Exemplo n.º 1
0
 /// <summary>
 /// Creates a new <see cref="Jsonize"/> object.
 /// </summary>
 public Jsonize()
 {
     _htmlDoc = _htmlDoc ?? new HtmlDocument();
     _emptyTextNodeHandling  = JsonizeConfiguration.DefaultEmptyTextNodeHandling;
     _nullValueHandling      = JsonizeConfiguration.DefaultNullValueHandling;
     _textTrimHandling       = JsonizeConfiguration.DefaultTextTrimHandling;
     _classAttributeHandling = JsonizeConfiguration.DefaultClassAttributeHandling;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new <see cref="Jsonize"/> object.
 /// </summary>
 public Jsonize()
 {
     // Fix #26: Form tag parsed as a text node.
     HtmlNode.ElementsFlags.Remove("form");
     _htmlDoc = _htmlDoc ?? new HtmlDocument();
     _emptyTextNodeHandling  = JsonizeConfiguration.DefaultEmptyTextNodeHandling;
     _nullValueHandling      = JsonizeConfiguration.DefaultNullValueHandling;
     _textTrimHandling       = JsonizeConfiguration.DefaultTextTrimHandling;
     _classAttributeHandling = JsonizeConfiguration.DefaultClassAttributeHandling;
 }
Exemplo n.º 3
0
        private void ApplyConfiguration(JsonizeConfiguration jsonizeConfiguration)
        {
            if (jsonizeConfiguration._emptyTextNodeHandling != null)
            {
                _emptyTextNodeHandling = jsonizeConfiguration.EmptyTextNodeHandling;
            }

            if (jsonizeConfiguration._nullValueHandling != null)
            {
                _nullValueHandling = jsonizeConfiguration.NullValueHandling;
            }

            if (jsonizeConfiguration._textTrimHandling != null)
            {
                _textTrimHandling = jsonizeConfiguration.TextTrimHandling;
            }

            if (jsonizeConfiguration._classAttributeHandling != null)
            {
                _classAttributeHandling = jsonizeConfiguration.ClassAttributeHandling;
            }
        }