XmlHierarchyConfigurator CreateObjectFromXml Method | Apache log4net™ SDK Documentation

Creates an object as specified in XML.

Namespace: log4net.Repository.Hierarchy
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    protected Object CreateObjectFromXml(
    	XmlElement element,
    	Type defaultTargetType,
    	Type typeConstraint
    )

    Protected Function CreateObjectFromXml (
    	element As XmlElement,
    	defaultTargetType As Type,
    	typeConstraint As Type
    ) As Object

    protected:
    Object^ CreateObjectFromXml(
    	XmlElement^ element,
    	Type^ defaultTargetType,
    	Type^ typeConstraint
    )

    member CreateObjectFromXml :
            element : XmlElement *
            defaultTargetType : Type *
            typeConstraint : Type -> Object

#### Parameters

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

#### Return Value

Type: Object
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

#### Reference

XmlHierarchyConfigurator Class
log4net.Repository.Hierarchy Namespace