ExpressionEvaluator.EvalXML Method (PIA)

Use this method to evaluate an expression represented as an Extensible Markup Language (XML) fragment.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Targeting
…
Public Function EvalXML(bstrXMLExpr As String,
 DictObjs As Object) As Object

[C#]

using Microsoft.CommerceServer.Interop.Targeting;
using Microsoft.CommerceServer.Interop;      //For IDictionary
…
public object EvalXML(stringbstrXMLExpr,
 IDictionarypDictObjs);

Parameters

[Visual Basic .NET]

  • bstrXMLExpr
    A String that contains the XML fragment to be evaluated.
  • DictObjs
    A Dictionary object that contains a set of profiles.

[C#]

  • bstrXMLExpr
    A string that contains the XML fragment to be evaluated.
  • pDictObjs
    The IDictionary interface of a Dictionary object that contains a set of profiles.

Return Values

This method returns an Object indicating the result of evaluating the expression is contained in the bstrXMLExpr parameter. The result may be True, False, or Null. The Null value indicates the expression could not be evaluated.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

[Visual Basic .NET]

The following table shows the custom COM errors that a COMException can wrap.

Value Description
&H81100018 Argument data type information missing from expression, or unrecognized argument data type encountered in expression
&H81100022 Invalid expression argument value, or impossible conversion
&H81100016 Invalid clause encountered
&H8110001F Invalid connection
&H81100017 Operator missing, unrecognized operator encountered, or type mismatch
&H81100015 Term type missing, or unrecognized term type encountered
&H81100014 Unrecognized XML element encountered
&H8110000D No connection string specified
&H81100013 XML DOM object parsing error

[C#]

The following table shows the custom COM errors that COMException can wrap.

Value Description
0x81100018 Argument data type information missing from expression, or unrecognized argument data type encountered in expression
0x81100022 Invalid expression argument value, or impossible conversion
0x81100016 Invalid clause encountered
0x8110001F Invalid connection
0x81100017 Operator missing, unrecognized operator encountered, or type mismatch
0x81100015 Term type missing, or unrecognized term type encountered
0x81100014 Unrecognized XML element encountered
0x8110000D No connection string specified
0x81100013 XML DOM object parsing error

Remarks

The XML is parsed before being evaluated. For information on the XML format, see Expression XML Structures.

Expressions evaluated using 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.

[Visual Basic .NET]

Example

' sXMLExpr is a string.
' Note that this string is not formatted properly with respect to
' quotation marks or continuation in order to increase readability.

strXMLExpr = "<CLAUSE OPER="equal">
                  <PROPERTY ID="User.firstName" TYPE="string" />
                  <IMMED-VAL TYPE="string">Jill</IMMED-VAL>
              </CLAUSE>"

' oResult is an Object
' dictProfiles is a Dictionary object containing a set of profiles
oResult = oExpressionEval.EvalXML(sXMLExpr, dictProfiles)

Requirements

Namespace: Microsoft.CommerceServer.Interop.Targeting

Platforms: Windows 2000, Windows Server 2003

Assembly: exprarchlib (in exprarchlib.dll)

See Also

Expression Recordset

Expression XML Structures

ExpressionEvaluatorClass

ExpressionEvaluator.Connect

ExpressionEvaluator.Eval

ExpressionEvaluator.ParseXML

Copyright © 2005 Microsoft Corporation.
All rights reserved.