xpath_string

XPath ifadesiyle eşleşen ilk xml düğümünün metin içeriğini döndürür.

Sözdizimi

from pyspark.sql import functions as sf

sf.xpath_string(xml, path)

Parametreler

Parametre Türü Description
xml pyspark.sql.Column veya str XML sütunu veya sütun adı.
path pyspark.sql.Column veya str XPath ifadesi.

Örnekler

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()
+--------------------+
|xpath_string(x, a/c)|
+--------------------+
|                  cc|
+--------------------+