xpath_string
XPath 式に一致する最初の XML ノードのテキスト コンテンツを返します。
構文
Python
from pyspark.sql import functions as sf
sf.xpath_string(xml, path)
パラメーター
パラメーター | Type | 説明 |
|---|---|---|
|
| XML 列または列名。 |
|
| XPath 式。 |
例
Python
from pyspark.sql import functions as sf
df = spark.createDataFrame([('<a><b>b</b><c>cc</c></a>',)], ['x'])
df.select(sf.xpath_string(df.x, sf.lit('a/c'))).show()
Output
+--------------------+
|xpath_string(x, a/c)|
+--------------------+
| cc|
+--------------------+