snowflake.snowpark.functions.check_xml¶
- snowflake.snowpark.functions.check_xml(col: Union[Column, str]) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L6161-L6182)¶
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 | ---------------------------------------------------