usnistgov / xslt-blender

XML/XSLT processing in the browser, supported by a Typescript library
Other
6 stars 2 forks source link

JSON reader fails on rootless JSON instances #3

Open joshualubell opened 1 year ago

joshualubell commented 1 year ago

For example, an OLIR derived relationship mapping report. derived-relationship-mapping.zip

wendellpiez commented 1 year ago

Yes, no kidding there's much it doesn't do. Thanks for trying @joshualubell !

I guess this demo is going to require more definition to complete. There are several options. Covering the full range of possible JSON inputs (in some way) is probably a good idea in any case.

How should a rootless JSON instance look? (What happens under a reference implementation of XPath 3.0 json-to-xml()?) This would give us a development target.

With respect to project definition, what will make the demo, as demo, serve better? Completeness and some level of assurance of completeness? Unit testing the Javascript function that produces XML for further consumption? Extending that function to provide cleaner exception handling?

Related to this issue is what should happen when something is loaded that does not parse as JSON.

joshualubell commented 1 year ago

I think the challenge has to do with what Michael Kay discussed in his Balisage talk: that maps and arrays are basic to JSON but not XML (although they were added to XPath 3.1). It's quite common for a JSON text to be either.

https://www.w3.org/TR/xpath-functions-31/#func-json-to-xml has examples showing output from json-to-xml when the input is a map. Also, the spec says that json-to-xml raises an error condition if the input does not conform to the JSON grammar as defined in RFC 7159.

Therefore, I think you can use json-to-xml both to determine whether your JSON Reader input is grammatically correct and as the first step of your rendering pipeline.

Josh

Joshua Lubell Systems Integration Division Engineering Laboratory National Institute of Standards and Technology Gaithersburg, Maryland, USA

From: Wendell Piez @.> Sent: Friday, September 30, 2022 5:51 PM To: usnistgov/xslt-blender @.> Cc: Lubell, Joshua (Fed) @.>; Mention @.> Subject: Re: [usnistgov/xslt-blender] JSON reader fails on rootless JSON instances (Issue #3)

Yes, no kidding there's much it doesn't do. Thanks for trying @joshualubellhttps://github.com/joshualubell !

I guess this demo is going to require more definition to complete. There are several options. Covering the full range of possible JSON inputs (in some way) is probably a good idea in any case.

How should a rootless JSON instance look? (What happens under a reference implementation of XPath 3.0 json-to-xml()?) This would give us a development target.

With respect to project definition, what will make the demo, as demo, serve better? Completeness and some level of assurance of completeness? Unit testing the Javascript function that produces XML for further consumption? Extending that function to provide cleaner exception handling?

Related to this issue is what should happen when something is loaded that does not parse as JSON.

- Reply to this email directly, view it on GitHubhttps://github.com/usnistgov/xslt-blender/issues/3#issuecomment-1264056364, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACRBFFQ2B67SWLLWXCMBQ4TWA5OCZANCNFSM6AAAAAAQZ7IHWI. You are receiving this because you were mentioned.Message ID: @.**@.>>