Commit 78f8712
authored
Fix handling with "xml:" prefixed namespace (#208)
I found parsing XHTML documents like below fails since v3.3.3:
```xml
<?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][spec] is a little bit ambiguous but document above
is valid according to an [article W3C serves][article].
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][samples] provided by
IDPF, former EPUB spec authority, use the style.
[spec]: https://www.w3.org/TR/REC-xml-names/#defaulting
[article]:
https://www.w3.org/International/questions/qa-html-language-declarations#attributes
[samples]: https://github.com/IDPF/epub3-samples1 parent 2e1cd64 commit 78f8712
File tree
2 files changed
+38
-2
lines changed- lib/rexml/parsers
- test/parser
2 files changed
+38
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| |||
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
188 | | - | |
| 189 | + | |
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| |||
790 | 791 | | |
791 | 792 | | |
792 | 793 | | |
793 | | - | |
| 794 | + | |
794 | 795 | | |
795 | 796 | | |
796 | 797 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
26 | 61 | | |
27 | 62 | | |
0 commit comments