| Issue 9: | Still possible to have escaping problems | |
| 1 person starred this issue and may be notified of changes. | Back to list |
The fix for this escaping problem: https://code.google.com/p/flexxb/issues/detail?id=8&can=1 seems to have been to just check for error 1088 in XmlElementSerializer: if (error.errorID == 1088){ child.appendChild(FlexXBUtil.getCDATAValue(stringValue)); } However, it's pretty easy to get other errors, such as 1090 'Malformed XML' or 1085 'The element type...must be terminated by the matching end-tag..." To reproduce those, just try to deserialize an object with an [XmlElement] with a value like "<" or "<sometag>". I've patched this for myself at line 47 of XmlElementSerializer like so: var stringValue : String = serializer.converterStore.objectToString(object, annotation.fieldType); stringValue = XML(new XMLNode(XMLNodeType.TEXT_NODE, stringValue)).toXMLString(); This basically just XML escapes everything, which is really the behavior I want any way (rather than the CDATA trick). That's a pretty gross way to XML escape but I can't find another way to do it in AS3. If would be swell if you could consider doing something like this in the real code so I can rip out my patch. :) Great framework, by the way - I hope you continue to support it. There aren't very many other good options out there.
Apr 8, 2009
Project Member
#1
alex.id....@gmail.com
Apr 8, 2009
(No comment was entered for this change.)
Status:
Accepted
Apr 8, 2009
Using XmlNode seems the best way to correctly escape special chars (long live Adobe :D). I changed a bit the way it is used in such a way as to make this conversion to XmlNode only if the normal conversion to XML throws an error. I expect the xmlNode to do some processing in order to escape special chars and there is no need to repeat this processing every time.
Apr 8, 2009
It should be fixed now. :D
Status:
Fixed
Dec 28, 2009
(No comment was entered for this change.)
Status:
Done
Dec 28, 2009
(No comment was entered for this change.)
Status:
Verified
|