IExpressionEval::ParseXML Method [C++]

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

Definition

[C++]

HRESULT IExpressionEval::ParseXML(BSTRbstrXMLExpr,
 VARIANT_BOOL*pbValid);

[Visual Basic]

Function ParseXML(bstrXMLExpr As String) As Boolean

Parameters

  • bstrXMLExpr[C++]
    [in] A BSTR that contains the XML text defining an expression.
  • bstrXMLExpr[Visual Basic]
    [in] A String that contains the XML text defining an expression.
  • pbValid[C++]
    [out, retval] A pointer to a VARIANT_BOOL indicating the validity of the expression.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

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

Error Values

[C++] 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.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM 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 [C++] 0x81100018

[Visual Basic] &H81100018

Argument data type information missing from expression, or unrecognized argument data type encountered in expression
E_EXPR_BADARGVALUE [C++] 0x81100022

[Visual Basic] &H81100022

Invalid expression argument value, or impossible conversion
E_EXPR_BADCLAUSE [C++] 0x81100016

[Visual Basic] &H81100016

Invalid clause encountered
E_EXPR_BADOPER [C++] 0x81100017

[Visual Basic] &H81100017

Operator missing, unrecognized operator encountered, or type mismatch
E_EXPR_BADTERM [C++] 0x81100015

[Visual Basic] &H81100015

Term type missing, or unrecognized term type encountered
E_EXPR_BADXML [C++] 0x81100014

[Visual Basic] &H81100014

An unrecognized XML element was encountered
E_EXPR_XMLPARSE [C++] 0x81100013

[Visual Basic] &H81100013

XML DOM object parsing error

[C++] 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.

[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

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

The expression store is not used for XML fragments.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[C++]

The pbValid parameter contains valid data only if the method completes successfully.

[Visual Basic]

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)

See Also

[C++]Expression Recordset

[C++]Expression XML Structures

[C++]ExpressionEval Object

[C++]IExpressionEval::Eval

[C++]IExpressionEval::EvalXML

[Visual Basic]Expression Recordset

[Visual Basic]Expression XML Structures

[Visual Basic]ExpressionEval Object

[Visual Basic]ExpressionEval.Eval

[Visual Basic]ExpressionEval.EvalXML

Copyright © 2005 Microsoft Corporation.
All rights reserved.