Is There a Way to Parse Xml Tags in Bigquery Standard Sql?
I Have Read That It's a Bad Idea to Parse Xml/Html Using Regular Expressions. the Alternative Suggestion Is to Use an Xml Parser. Does One Exist in the...
I have read that it's a bad idea to parse XML/HTML using regular expressions. The alternative suggestion is to use an XML parser. Does one exist in the BigQuery Standard SQL library?
1 Answer
Here is the documentation to how to use Javascript UDFs in BigQuery like Elliot has mentioned.
I imagine the UDF might look something like
CREATE TEMPORARY FUNCTION XML(x STRING)
RETURNS STRING
LANGUAGE js AS """
var data = fromXML(x);
return data.title;
"""
OPTIONS(
library="gs://<BUCKET_NAME>/from-xml.min.js"
);
SELECT XML(a) FROM UNNEST(["<title>Title of Page</title>"]) as a
Where from-xml.min.js is from this library and loaded into your gcs account