You are viewing documentation about an older version (1.4.0). View latest version

snowflake.snowpark.functions.check_xml

snowflake.snowpark.functions.check_xml(col: ColumnOrName) Column[source]

Checks the validity of an XML document. If the input string is a valid XML document or a NULL (i.e. no error would occur when parsing the input string), the function returns NULL. In case of an XML parsing error, the output string contains the error message.

Example:

>>> df = session.create_dataframe(["<name> Valid </name>", "<name> Invalid </WRONG_CLOSING_TAG>", None], schema=['a'])
>>> df.select(check_xml(df.a)).show()
---------------------------------------------------
|"CHECK_XML(""A"")"                               |
---------------------------------------------------
|NULL                                             |
|no opening tag for </WRONG_CLOSING_TAG>, pos 35  |
|NULL                                             |
---------------------------------------------------
Copy