Sitecore 5.1.1 API

ConfigReader.GetConfigNodes Method 

Gets a list of config nodes matching an xpath.

[Visual Basic]
Public Shared Function GetConfigNodes( _
   ByVal xpath As String _
) As XmlNodeList
[C#]
public static XmlNodeList GetConfigNodes(
   string xpath
);

Parameters

xpath
XPath of node to find (relative to the sitecore node).

Return Value

Requested configuration nodes. If no nodes are found, null is returned.

Remarks

The xpath must be relative to the sitecore node. It must never start with /

Example

Get the list of item event handlers:

  XmlNodeList nodes = ConfigReader.GetConfigNodes("eventHandlers/items");
  
  foreach(XmlNode node in nodes) {
    MainUtil.Out("Type: " + XmlUtil.GetAttribute("type", node));
  }
Outputs:
  Type: Sitecore.Logging
  Type: Sitecore.WebEdit.ItemEventHandler
  Type: Sitecore.Preview.ItemEventHandler

See Also

ConfigReader Class | Sitecore.Configuration Namespace