Sitecore 5.0 API

MainUtil.IsXPath Method 

Checks if a string contains an XPath expression.

[Visual Basic]
Public Shared Function IsXPath( _
   ByVal path As String _
) As Boolean
[C#]
public static bool IsXPath(
   string path
);

Parameters

path
A string, possiblyh containing an XPath expression.

Return Value

True, if the string contains an XPath expression, otherwise false.

Remarks

This function can be used to differentiate between Sitecore paths and XPath expressions. A path is considered an XPaath expression if it contains "item[" or "::item".

Example

  bool b0 = MainUtil.IsXPath("/item[@key='sitecore']/item[@key='content']"); // true
  bool b1 = MainUtil.IsXPath("/sitecore/content"); // false

See Also

MainUtil Class | Sitecore Namespace