Issue #74 - add the fn:parse-html function - #259
Conversation
|
Possibly there should be an html-version option as per Serialization spec and XSLT. And possibly allow automatic detection of HTML 5 vs quirks mode vs XHTML with validation?? I like simple, but i am not confident hard-wiring HTML 5 (as opposed to XHTML 5 or XHTML 1.1) is necessarily the way to go. Of course, the HTML 5 spec says what to do with these too, but the proposed prose here seems explicit that only HTML 5 is accepted. Nonetheless i'm very pleased to see this. |
|
@liamquin I've incorporated your suggestions into the spec. Thanks! |
|
Could I ask what are the implications of
We've always had a problem with multiple (human) editors using multiple (software) editors causing whitespace changes that disrupt change marking and conflict resolution. I don't know what an .editorconfig file does: is it going to help with this problem or make it worse? |
An editor config file allows you to specify the encoding, line ending, indentation style, etc. for files in the project. This allows you to have different rules for different language extensions, or even different files. The settings are documented in https://editorconfig.org/. I added it because my IDE (IntelliJ IDEA) was defaulting to 4 characters indentation of the elements instead of the 3 that the files use. As such, I've added a rule in the editor config to make that consistent. I've not extended it to other settings such as encoding, line endings, or removing trailing spaces. |
…sors consistent with the text node specification text.
|
The XDM node mapping for the HTML DOM is now complete. I've incorporated @michaelhkay's notes from the issue, except for the point about if case normalization is needed. |
|
I think I'd have a marginal preference for putting method-specific additional parameters in their own key: instead of Conflating the two together means you can't have a parameter with the same name as our options and means we can't safely add any new optionsin the future because someone might be using them as method parameter names. |
|
A higher-level comment is that, while I don't object to the options provided, I'd have been equally happy if the function said that the input string is parsed with the HTML5 parsing algorithm, full stop. |
Sounds reasonable to me, not just because TagSoup has a |
|
Drop 2.6.14 fn:parts. Superseded by parse-uri.
Drop 2.6.15 EQNames - done.
Drop 2.6.16 parse-html - duplicate of 2.3
Drop 2.6.18 fn:until - done (as fn:iterate-while)
Drop 2.6.19 - (fn:CR etc) duplicate of 2.4
Mike
|
|
I think the comment about dropping various 2.6.x things is related to the agendas. I've made those changes for the next agenda. |
|
I think we need greater clarity as regards error handling. The proposed spec says:
But I'm not sure the concept of a "well-formed HTML document" is well defined. Specifically, there seem to be differences between implementations of the HTML5 parsing algorithm (both in browsers, and in free-standing libraries) as to how much recovery is attempted. For example the proposed test case test-003 include the ill-formed SVG fragment: (note the missing end tag for We could take several paths:
I think this is probably a case for pragmatism; implementations are going to want to use existing parsing libraries, and if these differ in their behaviour, it's probably best to leave things implementation-defined. There are no easy answers here; the HTML5 spec has a lot of fuzziness. For example, most of the requirements it places on "user agents" are not applicable because they only affect rendering and interaction, but the construction of a DOM from lexical HTML is also described as a function of a "user agent". |
This PR makes the following changes:
.editorconfigfile to allow editors and IDEs to indent the XML source documents consistently.The function specification itself is complete. The HTML DOM to XDM node mapping currently only contains the overview. I'm going to write that for this PR, this is just to start the ball rolling in specifying this function.