Skip to content
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

Fix handling with "xml:" prefixed namespace #208

Merged
merged 5 commits into from
Sep 29, 2024
Merged

Conversation

KitaitiMakoto
Copy link
Contributor

Hello,

I found parsing XHTML documents like below fails since v3.3.3:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>XHTML Document</title>
  </head>
  <body>
    <h1>XHTML Document</h1>
    <p xml:lang="ja" lang="ja">この段落は日本語です。</p>
  </body>
</html>

XML namespace spec is a little bit ambiguous but document above is valid according to an article W3C serves.

I fixed the parsing algorithm. Can you review it?

As an aside, <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> style language declaration is often used in XHTML files included in EPUB files because sample EPUB files provided by IDPF, former EPUB spec authority, use the style.

@KitaitiMakoto KitaitiMakoto changed the title Lang attr Fix handling with "xml:" prefixed namespace Sep 27, 2024
Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

test/parser/test_base_parser.rb Outdated Show resolved Hide resolved
test/parser/test_base_parser.rb Outdated Show resolved Hide resolved
lib/rexml/parsers/baseparser.rb Outdated Show resolved Hide resolved
@KitaitiMakoto
Copy link
Contributor Author

@kou Thanks for your review! I fixed patches.

@kou kou merged commit 78f8712 into ruby:master Sep 29, 2024
58 of 61 checks passed
@kou
Copy link
Member

kou commented Sep 29, 2024

Thanks.

@KitaitiMakoto KitaitiMakoto deleted the lang-attr branch September 29, 2024 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants