-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add adaptive & json output option for query results #121
Conversation
var url = 'results/' + currentOffset; | ||
currentOffset++; | ||
$.ajax({ | ||
url: url, | ||
dataType: 'html', | ||
data: { "output": serializationMode }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice I have to pass the serialization/output parameter to the /retrieve
endpoint so it knows whether to pretty-print the results as XML Output or Adaptive Output.
Nice! very extensive.... |
Thank you @dizzzz! |
fixes error where `map {"a": "b", "c": "d"}` was being displayed as `map {"a": "b"}map {"c": "d"}`.
- use fn, math, map, array, xs, local namespace prefixes - for empty or any other namespace, use clark notation
use white-space CSS instead of `<pre>` element to ensure output uses same font as other modes, while preserving whitespace in output
add adaptive & json output option for query results
@wolfgangmm Thanks for accepting the contribution! I hope people find it useful. I have some other ideas for improvements along these lines. |
Thanks a lot for this work ! looks really good ; ) |
Thanks, that's great to hear, @christophe-g! |
summary
update (Jan 17, 2016)
fn:serialize
using JSON serialization output options with indent="yes". relieves users of pasting in the verbose serialization options when working with strictly JSON datamotivation
name="value"
form, strings are surrounded with quotation marks (e.g.,"a"
or"42"
), and numbers are not (e.g.,42
); and because i've applied basic syntax coloring to the results - borrowing both from ace's default coloring for XQuery as well as the classes used in the XML pretty printing function. the color selections are preliminary and could probably be improved:illustrations
![screen shot 2016-01-15 at 3 05 49 am](https://cloud.githubusercontent.com/assets/59118/12348398/01984dbe-bb35-11e5-8615-86274f170ae1.png)
- to the new Adaptive Output:![screen shot 2016-01-18 at 11 44 24 pm](https://cloud.githubusercontent.com/assets/59118/12409937/75668368-be3d-11e5-87af-4a478e5b665b.png)
- and compare the old boilerplate for serializing JSON and the unindented results:![screen shot 2016-01-17 at 11 45 16 pm](https://cloud.githubusercontent.com/assets/59118/12383471/984ead3e-bd74-11e5-8171-5a4e0b430e18.png)
- to the new JSON Output option, with more direct code and indented results:![screen shot 2016-01-17 at 11 57 13 pm](https://cloud.githubusercontent.com/assets/59118/12383609/15a73dd6-bd76-11e5-88bc-496bfdc0dd86.png)
## additional notes - i've taken pains not to alter eXide's existing behavior for the "XML Output" in any way - also, when outputting normal XML nodes, eXide uses the same pretty printing function as before, even when in "Adaptive Output" mode - thus the only change users will encounter when they select "Adaptive Output" mode, is when results include (1) attribute nodes or (2) the non-node XDM data types supported by adaptive output - i placed "Adaptive Output" as the first option in the drop down menu, because (1) alphabetically it precedes XML and (2) the effect on users is limited since the only change users would notice would be for attribute nodes and non-XDM datatypes. but since this changes the default, I could certainly move it down below "XML Output" if preferred. - the only other concern is that users may think that adaptive output is supported as a full-blown serialization option (i.e., outside of eXide), but (1) i imagine that this option may be added at some point anyway, and (2) in the meantime such a misunderstanding could be prevented through documentation (release notes, a new "did you know" pop-up, etc.). i think this concern is much smaller, though, than the benefit users would get from this option as they increasingly make use of non-node datatypes. ## test queries... from the illustrations above