You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by ni...@apache.org on 2005/06/15 19:54:21 UTC

cvs commit: logging-log4net/src/Repository/Hierarchy XmlHierarchyConfigurator.cs

nicko       2005/06/15 10:54:21

  Modified:    src/Repository/Hierarchy XmlHierarchyConfigurator.cs
  Log:
  Applied patch for LOG4NET-34 Allow xml config values to be set via XmlNodeType.CDATA or XmlNodeType.Text rather than just value=xxx
  
  Revision  Changes    Path
  1.17      +24 -3     logging-log4net/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs
  
  Index: XmlHierarchyConfigurator.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XmlHierarchyConfigurator.cs	17 Jan 2005 20:18:47 -0000	1.16
  +++ XmlHierarchyConfigurator.cs	15 Jun 2005 17:54:21 -0000	1.17
  @@ -23,8 +23,6 @@
   using System.Xml;
   
   using log4net.Appender;
  -using log4net.Layout;
  -using log4net.Filter;
   using log4net.Util;
   using log4net.Core;
   using log4net.ObjectRenderer;
  @@ -591,10 +589,33 @@
   			}
   			else
   			{
  +				string propertyValue = null;
  +
   				if (element.GetAttributeNode(VALUE_ATTR) != null)
   				{
  -					string propertyValue = element.GetAttribute(VALUE_ATTR);
  +					propertyValue = element.GetAttribute(VALUE_ATTR);
  +				}
  +				else if (element.HasChildNodes)
  +				{
  +					// Concatenate the CDATA and Text nodes together
  +					foreach(XmlNode childNode in element.ChildNodes)
  +					{
  +						if (childNode.NodeType == XmlNodeType.CDATA || childNode.NodeType == XmlNodeType.Text)
  +						{
  +							if (propertyValue == null)
  +							{
  +								propertyValue = childNode.InnerText;
  +							}
  +							else
  +							{
  +								propertyValue += childNode.InnerText;
  +							}
  +						}
  +					}
  +				}
   
  +				if(propertyValue != null)
  +				{
   #if !NETCF	
   					try
   					{