-
Notifications
You must be signed in to change notification settings - Fork 16
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
Parse functions: consistency #748
Comments
Isn't there also fn:parse-xml-fragment ? As for the name of the input parameter, it should be obvious that the name "input" is more precise than "value". In fact "value" seems to be a most generic and useless name - everything can be regarded as a value of something, |
Yes, there are various functions that I didn’t list here, including
I agree, but this would conflict with the current conventions for naming the functions in the spec. I’ve forgotten where the semantics had been specified; simply spoken, atomic parameters are called |
Could rename |
Probably too late, as we cannot change the behavior of existing functions. We could introduce an options parameter to However, we could introduce an
(would be topic for another issue) |
See also issue #490 |
The rationale for allowing |
Hi Reece, I agree that’s a good idea. I believe it would be similary relevant for XML input, so I think we should either restrict binary input to a new |
My reseration on restricting enoding to a Allowing binary items on other parse functions would be useful for a similar reason. |
As we’ve currently no standard function that allows us to read binary contents (which could then be processed with |
Following on from the QTCG meeting of 2023-10-17, I've tried to summarise the discussion about Parsing functions in generalThere were a lot of questions regarding the scope and naming of parsing functions, and the approaches that had been, or could potentially be, taken. The two scope approaches were, broadly, several single-purpose/single-output-format functions, or one multi-purpose function whose output format was controlled with an option passed in an options parameter map. There were specific questions about CSV and why there were two functions proposed that had XDM output instead of one.
With This confusion suggests to me that if a new data-format function has functions to support consuming it added they should add a Input sourcesThere was discussion about what input parse functions should be able to accept. Since that discussion, further discussion about handling binary data, from the proposal for For myself, I have been thinking about this and wondering if |
Thanks, Matt for the summary.
Interestingly, I had similar thoughts in the past: It seemed simple enough to me to combine |
There was another reason for introducing |
In my unchained-by-reality wondering, I imagine an There's a 2-argument form that returns the text, with the second argument specifying what to do with non-xml characters, allowing someone to skip the indirection... |
The functions for parsing input have been defined by different people, and the current state is quite inconsistent:
fn:parse-xml
$value as xs:string?
fn:doc
$href as xs:string?
fn:parse-json
$value as xs:string?, $options as map(*)
fn:json-doc
$href as xs:string?, $options as map(*)
fn:parse-html
$html as union(xs:string, xs:hexBinary, xs:base64Binary)?, $options as map(*)
fn:parse-csv
$csv as xs:string?, $options as map(*)
I believe there’s some need to unify the functions, and we could at least:
fn:XYZ-doc($href, $options)
function for each input format (with at least oneencoding
option), andfn:parse-XYZ
toxs:string?
and always name it$value
.And I wonder if we should tag all
fn:XYZ-doc
functions as ·nondeterministic· (if it’s not too late)?The text was updated successfully, but these errors were encountered: