[ALOY-1209] Compile error when a view's attribute contains an escaped quote
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Resolved |
Resolution | Won't Fix |
Resolution Date | 2015-01-09T14:26:14.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.7.0 |
Components | XML |
Labels | TCSupportTriage, alloy, compile, view |
Reporter | Fokke Zandbergen |
Assignee | Tim Poulsen |
Created | 2014-11-12T14:01:58.000+0000 |
Updated | 2015-01-09T14:26:14.000+0000 |
Description
The following view:
<Alloy>
<Window>
<Label html="Hello <b>Bold</b> <font color=\"red\">World!</font>" />
</Window>
</Alloy>
Will result in the following compile error:
[INFO] view: "index.xml"
[WARN] attribute space is required"html"!!
[WARN] @#[line:3,col:3]
[ERROR] Error parsing XML file.
[ERROR] element parse error: Error: attribute value must after "="
[ERROR] @#[line:3,col:3]
[ERROR] Alloy compiler failed
I'd expect this to work fine since the "
is escaped?
Workaround by [~skypanther]:
The correct way to escape (double) quotes in XML according to the [specification](http://www.w3.org/TR/REC-xml/#syntax) is to use
"
or use<![CDATA[ .. ]]>
in a text node. I think with this argument this ticket can be closed as *Won't Fix*Resolving per Fokke's comments. Escaped characters aren't supported in XML, we don't support CDATA blocks, and there's no reliable way to replace quotes (escaped or otherwise) in attribute values given the many possible permutations of strings developers might use. Additional workarounds would be to put the strings into the TSS or JS, or for quotes within HTML (not surrounding attributes as in the original problem description) would be to use entities like “