diff --git a/doc/_stdlib_gen/stdlib-content.jsonnet b/doc/_stdlib_gen/stdlib-content.jsonnet index dd662773d..5cd9316be 100644 --- a/doc/_stdlib_gen/stdlib-content.jsonnet +++ b/doc/_stdlib_gen/stdlib-content.jsonnet @@ -618,6 +618,44 @@ local html = import 'html.libsonnet'; }, ], }, + { + name: 'parseXmlJsonml', + params: ['str', 'preserveWhitespace=false'], + availableSince: 'upcoming', + description: [ + html.p({}, ||| + Parses a XML string to JsonML-encoded value. The XML should only contain + one root node. + |||), + html.p({}, ||| + By default, all the boundary whitespace would be trimmed. It could be preserved using preserveWhitespace + argument of the function. + |||), + ], + examples: [ + { + input: "std.parseXmlJsonml('')", + output: [ + "svg", + { + "height": "100", + "width": "100" + }, + [ + "circle", + { + "cx": "50", + "cy": "50", + "fill": "red", + "r": "40", + "stroke": "black", + "stroke-width": "3" + } + ] + ], + }, + ], + }, { name: 'encodeUTF8', params: ['str'], diff --git a/stdlib/std.jsonnet b/stdlib/std.jsonnet index c861a4aec..07bdfb2fb 100644 --- a/stdlib/std.jsonnet +++ b/stdlib/std.jsonnet @@ -1785,4 +1785,6 @@ limitations under the License. sha3(str):: go_only_function, trim(str):: std.stripChars(str, ' \t\n\f\r\u0085\u00A0'), + + parseXmlJsonml(str):: go_only_function, }