Commit 4073f3e
[generator] Fix loading broken annotation XML (#415)
Context: https://issuetracker.google.com/issues/116182838
Google shipped invalid (not well-formed) XML annotation documents in
the `platform-tools` 28.0.1 package, with `<` present within element
attributes:
<item name="android.view.View void addFocusables(java.util.ArrayList<android.view.View>, int) 1">
Note the `java.util.ArrayList<android.view.View>` within the
`//item/@name` attribute value, and that the `<` isn't escaped.
This invalid XML prevents System.Xml from loading the
`annotations.xml` documents, with errors similar to:
android/view/annotations.xml failed: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 206, position 71
This commit takes advantage of the forgiving nature of the
HtmlAgilityPack HTML parser -- which loads those files fine -- and
makes it possible for us to write them back using `XmlWriter` in
order to generate a well-formed XML document which we can load into
`XDocument`.
Slow, but it works...1 parent 3a99c2f commit 4073f3e
File tree
3 files changed
+67
-1
lines changed- src/Xamarin.Android.Tools.AnnotationSupport
3 files changed
+67
-1
lines changedLines changed: 60 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | | - | |
| 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 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
28 | 87 | | |
29 | 88 | | |
30 | 89 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments