File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -602,6 +602,39 @@ local html = import 'html.libsonnet';
602602 },
603603 ],
604604 },
605+ {
606+ name: 'parseXmlJsonml' ,
607+ params: ['str' ],
608+ availableSince: 'upcoming' ,
609+ description: [
610+ html.p({}, |||
611+ Parses a XML string to <a href="http://www.jsonml.org/">JsonML</a>-encoded value. The XML should only contain one root node.
612+ ||| ),
613+ ],
614+ examples: [
615+ {
616+ input: "std.parseXmlJsonml('<svg height=\" 100\" width=\" 100\" ><circle cx=\" 50\" cy=\" 50\" fill=\" red\" r=\" 40\" stroke=\" black\" stroke-width=\" 3\" ></circle></svg>')" ,
617+ output: [
618+ "svg" ,
619+ {
620+ "height" : "100" ,
621+ "width" : "100"
622+ },
623+ [
624+ "circle" ,
625+ {
626+ "cx" : "50" ,
627+ "cy" : "50" ,
628+ "fill" : "red" ,
629+ "r" : "40" ,
630+ "stroke" : "black" ,
631+ "stroke-width" : "3"
632+ }
633+ ]
634+ ],
635+ },
636+ ],
637+ },
605638 {
606639 name: 'encodeUTF8' ,
607640 params: ['str' ],
Original file line number Diff line number Diff line change @@ -1766,4 +1766,5 @@ limitations under the License.
17661766 sha256(str):: go_only_function,
17671767 sha512(str):: go_only_function,
17681768 sha3(str):: go_only_function,
1769+ parseXmlJsonml(str):: go_only_function,
17691770}
You can’t perform that action at this time.
0 commit comments