Repository navigation
Conversation
Since 3.3.1, a processing instruction in the internal subset raises "Malformed DOCTYPE: invalid declaration", although [28b] intSubset allows PIs (markupdecl | DeclSep, [29] markupdecl includes PI). 3.3.0 and earlier accepted them. Parse them with process_instruction, as for PIs outside the DOCTYPE; an XML declaration there is still rejected.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since 3.3.1, a processing instruction inside the internal subset raises
Malformed DOCTYPE: invalid declaration:PIs are allowed there: [28b]
intSubset ::= (markupdecl | DeclSep)*and [29]markupdeclincludesPI. Expat (Python'sxml.etree) also accepts this. The:in_doctypebranch ofBaseParser#pull_eventhandles<!...declarations, parameter entity references and]>, but not<?. This change parses PIs there withprocess_instruction, as outside the DOCTYPE. An XML declaration in the internal subset is still rejected ("XML declaration is not at the start").I found this by running the W3C XML Conformance Test Suite (xmlts20130923) against REXML: six valid documents that only failed because of this now parse (oasis p29pass1 and IBM P02/P03/P28/P29 valid tests).
Tests:
test_instruction_element(DOCTYPE mixed content),test_in_internal_subsetandtest_xml_declaration_in_internal_subset(processing instructions). All three fail before the change (the third got the generic "invalid declaration" error) and pass after it.bundle exec rake testpasses (844 tests), as doesbundle exec rake test RUBYOPT="--enable-frozen-string-literal".