snowflake.snowpark.functions.xpath_int¶
- snowflake.snowpark.functions.xpath_int(col: Union[Column, str], path: str) Column [source]¶
Extracts an integer value from an XML column using an XPath expression.
Returns NULL if no matches are found or value cannot be converted to integer. Floats are truncated to integers (e.g., 1.9 becomes 1).
- Parameters:
col – Column containing XML data
path – XPath expression string
Example:
>>> df = session.create_dataframe([['<root><count>42</count></root>']], schema=['xml']) >>> df.select(xpath_int('xml', '//count/text()').alias('count')).collect() [Row(COUNT=42)]