File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
src/main/xar-resources/data/docs/fn Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ # fn: xml-to-json () ([ specification] ( https://www.w3.org/TR/xpath-functions-31/#func-xml-to-json" ) )
2+ handles most valid input according to specification. Notable exceptions follow.
3+
4+ All (un-)escaping is delegated to com.fasterxml.jackson. All output is generated by jackson
5+ and should be proper JSON.
6+
7+ ` fn:xml-to-json() ` does not replace codepoints in the range ` 1-31 ` or ` 127-159 ` in any string or map key.
8+
9+ ` fn:xml-to-json() ` unescapes and reescapes any string and map key marked as being escaped.
10+ It does not do additional special character replacements mentioned in the spec.
11+ It does not do an otherwise verbatim copy.
12+
13+ # Examples
14+ ## 1)
15+ ``` xquery
16+ let $node := <string></string>
17+ return fn:xml-to-json($node)
18+ ```
19+ does return ` "" ` and not ` "\u007F" ` .
20+
21+ ## 2)
22+ ``` xquery
23+ let $node := <string escaped="true">\/</string>
24+ return fn:xml-to-json($node)
25+ ```
26+ does return ` "/" ` and not ` "\/" ` .
27+
28+ ##3 )
29+ ``` xquery
30+ let $node := <string escaped="true"></string>
31+ return fn:xml-to-json($node)
32+ ```
33+ does return ` "" ` and not ` "\u007F" ` .
34+
35+ ## 4)
36+ ``` xquery
37+ let $node := <string escaped="true">""</string>
38+ return fn:xml-to-json($node)
39+ ```
40+ does return ` "" ` and not ` "\"\"" ` .
41+
You can’t perform that action at this time.
0 commit comments