log4net SDK Reference |

# XmlHierarchyConfigurator.CreateObjectFromXml Method

Creates an object as specified in XML.

[Visual Basic]
Protected Function CreateObjectFromXml( _
ByVal element As XmlElement, _
ByVal defaultTargetType As Type, _
ByVal typeConstraint As Type _
) As Object
[C#]
protected object CreateObjectFromXml(
XmlElement element,
Type defaultTargetType,
Type typeConstraint
);

#### Parameters

element
  The XML element that contains the definition of the object.
defaultTargetType
  The object type to use if not explicitly specified.
typeConstraint
  The type that the returned object must be or must inherit from.

#### Return Value

The object or `null`

#### Remarks

Parse an XML element and create an object instance based on the configuration data.

The type of the instance may be specified in the XML. If not specified then the defaultTargetType is used as the type. However the type is specified it must support the typeConstraint type.

#### See Also

XmlHierarchyConfigurator Class | log4net.Repository.Hierarchy Namespace