fix(jruby): serialize entity refs or the replacement text, not both#3272
Merged
flavorjones merged 1 commit intomainfrom Jul 3, 2024
Merged
fix(jruby): serialize entity refs or the replacement text, not both#3272flavorjones merged 1 commit intomainfrom
flavorjones merged 1 commit intomainfrom
Conversation
ef996f8 to
12fd018
Compare
Two things getting fixed here: 1. We were not calling `setFeature(FEATURE_NOT_EXPAND_ENTITY, ...)` correctly. It defaults to true, and we were conditionally setting it to true. Instead, let's just explicitly set this feature (and the other features we care about) to avoid mistaken assumptions about the default. 2. We were rendering the children of the EntityReference, which contains the replacement text, as well as the EntityReference itself. We should only ever render one or the other. If NOENT is false, though, there won't be any EntityReferences in the DOM. So: if we encounter an EntityReference, don't render its children. See https://xerces.apache.org/xerces-j/features.html section on `create-entity-ref-nodes` for a deeper explanation of the parser behavior. Closes #3270
12fd018 to
aad5c90
Compare
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.
What problem is this PR intended to solve?
Two things getting fixed here:
We were not calling
setFeature(FEATURE_NOT_EXPAND_ENTITY, ...)correctly. It defaults to true, and we were conditionally setting it to true. Instead, let's just explicitly set this feature (and the other features we care about) to avoid mistaken assumptions about the default.We were rendering the children of the EntityReference, which contains the replacement text, as well as the EntityReference itself. We should only ever render one or the other. If NOENT is false, though, there won't be any EntityReferences in the DOM. So: if we encounter an EntityReference, don't render its children.
See https://xerces.apache.org/xerces-j/features.html section on
create-entity-ref-nodesfor a deeper explanation of the parser behavior.Closes #3270
Have you included adequate test coverage?
Yes
Does this change affect the behavior of either the C or the Java implementations?
This fixes a bug in the Java implementation, so it behaves like the C impl.