ExpressionEvaluator.ParseXML Method (PIA)

Use this method to check whether an Extensible Markup Language (XML) fragment is a syntactically correct expression.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Targeting
…
Public Function ParseXML(bstrXMLExpr As String) As Boolean

[C#]

using Microsoft.CommerceServer.Interop.Targeting;
…
public void ParseXML(stringbstrXMLExpr);

Parameters

[Visual Basic .NET]

  • bstrXMLExpr
    A String that contains the XML text defining an expression.

[C#]

  • bstrXMLExpr
    A string that contains the XML text defining an expression.

Return Values

[Visual Basic .NET] This method returns a Boolean value indicating the results of parsing the expression (bstrXMLExpr).

[C#] This method returns a bool indicating the validity of the expression.

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
&H81100017 Operator missing, unrecognized operator encountered, or type mismatch
&H81100015 Term type missing, or unrecognized term type encountered
&H81100014 Unrecognized XML element encountered
&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
0x81100017 Operator missing, unrecognized operator encountered, or type mismatch
0x81100015 Term type missing, or unrecognized term type encountered
0x81100014 Unrecognized XML element encountered
0x81100013 XML DOM object parsing error

Remarks

Because this method checks only syntax, the expression may still be invalid even though the method succeeds.

The expression store is not used for XML fragments.

[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>"

' bResult is a Boolean

bResult = oExpressionEval.ParseXML(sXMLExpr)

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.Eval

ExpressionEvaluator.EvalXML

Copyright © 2005 Microsoft Corporation.
All rights reserved.