IExpressionEval::EvalXML
Use this method to evaluate an expression represented as an Extensible Markup Language (XML) fragment.
Definition
HRESULT IExpressionEval::EvalXML(BSTRbstrXMLExpr,IDictionary*pDictObjs,VARIANT* pvResult);
Parameters
bstrXMLExpr
[in] A BSTR that contains the XML fragment to be evaluated.
pDictObjs
[in] A pointer to the IDictionary interface of a Dictionary object that contains a set of profiles.
pvResult
[out, retval] A pointer to a VARIANT indicating the results of evaluating the expression in the specified context.
Return Values
This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details. The result of evaluating the expression is contained in the pvResult parameter. The result may be TRUE, FALSE, or NULL. NULL indicates the expression could not be evaluated.
Error Values
This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.
The following table shows the custom COM errors that this method can return.
Constant | Value | Description |
E_EXPR_BADARGTYPE | 0x81100018 | Argument datatype information missing from expression, or unrecognized argument data type encountered in expression |
E_EXPR_BADARGVALUE | 0x81100022 | Invalid expression argument value, or impossible conversion |
E_EXPR_BADCLAUSE | 0x81100016 | Invalid clause encountered |
E_EXPR_BADCONNECTION | 0x8110001F | Invalid connection |
E_EXPR_BADOPER | 0x81100017 | Operator missing, unrecognized operator encountered, or type mismatch |
E_EXPR_BADTERM | 0x81100015 | Term type missing, or unrecognized term type encountered |
E_EXPR_BADXML | 0x81100014 | An unrecognized XML element was encountered |
E_EXPR_NOCONNECTIONSTRING | 0x8110000D | No connection string specified |
E_EXPR_XMLPARSE | 0x81100013 | XML DOM object parsing error |
Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.
Remarks
The XML is parsed before being evaluated. For information on the XML format, see Expression XML Structures.
Expressions evaluated with the EvalXML method are not persistent; that is, they are not stored in the expression store or loaded into the expression cache. Use the Eval method to evaluate persistent expressions.
A new ExprEvalContext object is created and then discarded for each XML fragment that is evaluated.
The Connect method must be called before using the EvalXML method.
For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.
The pvResult parameter contains valid data only if the method completes successfully.