Subdomain 1.1: Use a collection system to retrieve data.
1.An analyst loads XML documents into a `VARIANT` column named `doc` and needs to pull out the child element `<customer>` from each record. Which function retrieves a child element of an XML value by its tag name?
- A.`PARSE_XML`
- B.`XMLGET`
- C.`CHECK_XML`
- D.`STRIP_NULL_VALUE`
Show answer & explanation
Correct answer: B — `XMLGET`
- A. `PARSE_XML` converts a string into an XML-typed VARIANT. It does not pick a child element from a value that is already parsed.
- B. `XMLGET` returns the child element with the given tag name from an XML value, for example `XMLGET(doc, 'customer')`, and reads the content with `:"$"`.
- C. `CHECK_XML` only validates whether text is well-formed XML and returns an error message or NULL, so it extracts nothing.
- D. `STRIP_NULL_VALUE` converts JSON null in a VARIANT to SQL NULL and has no concept of XML tags.