XPath.Compile Method (string, XPathSettings)XPath.Compile Method (String, XPathSettings)XPath::Compile Method (String^, XPathSettings^)

Compiles an XPath expression and returns a XPathXPathXPath object that represents the expression.

Syntax

Public Shared Function Compile( _
    expression As String, _
    settings As XPathSettings _
) As XPath
public static XPath Compile(
    string expression,
    XPathSettings settings
)
public:
static XPath^ Compile(
    String^ expression, 
    XPathSettings^ settings
)
 

Parameters

expression

Type: System.StringSystem.StringSystem::String^

An XPath expression.

settings

Type: XmlPrime.XPathSettingsXmlPrime.XPathSettingsXmlPrime::XPathSettings^

The initial static context settings.

Return Value

Type: XmlPrime.XPathXmlPrime.XPathXmlPrime::XPath^

An XPathXPathXPath object, or null a null reference (Nothing in Visual Basic) nullptr if an unrecoverable error was raised and handled by a subscriber to CompilationErrorCompilationErrorCompilationError

Exceptions

ExceptionCondition
ArgumentNullExceptionArgumentNullExceptionArgumentNullException expression or settings is null a null reference (Nothing in Visual Basic) nullptr
XdmExceptionXdmExceptionXdmExceptionAn error occurred compiling the expression.

Remarks

Any errors or warnings encountered during compilation raise the CompilationErrorCompilationErrorCompilationError event. If nothing subscribes to this event then an XdmExceptionXdmExceptionXdmException is thrown if an unrecoverable error is encountered. If this event is subscribed to then the exception is not thrown, and this method returns null a null reference (Nothing in Visual Basic) nullptr instead.