You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2017/10/18 20:50:58 UTC
[royale-asjs] branch develop updated: Support unescaped ampersands
in XML constructors.
This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 15e3c22 Support unescaped ampersands in XML constructors.
15e3c22 is described below
commit 15e3c22e92c85d3fb2b83ffaf82c2316e8d4c46b
Author: Harbs <ha...@in-tools.com>
AuthorDate: Wed Oct 18 23:50:55 2017 +0300
Support unescaped ampersands in XML constructors.
---
frameworks/projects/XML/src/main/royale/XML.as | 2 ++
manualtests/XMLTest/src/MyInitialView.mxml | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/frameworks/projects/XML/src/main/royale/XML.as b/frameworks/projects/XML/src/main/royale/XML.as
index dfe939e..d2e8831 100644
--- a/frameworks/projects/XML/src/main/royale/XML.as
+++ b/frameworks/projects/XML/src/main/royale/XML.as
@@ -379,6 +379,8 @@ package
private static var errorNS:String;
private function parseXMLStr(xml:String):void
{
+ //escape ampersands
+ xml = xml.replace(/&(?![\w]+;)/g,"&");
var parser:DOMParser = new DOMParser();
if(errorNS == null)
{
diff --git a/manualtests/XMLTest/src/MyInitialView.mxml b/manualtests/XMLTest/src/MyInitialView.mxml
index 6c7f12c..85f7f31 100644
--- a/manualtests/XMLTest/src/MyInitialView.mxml
+++ b/manualtests/XMLTest/src/MyInitialView.mxml
@@ -108,6 +108,12 @@ limitations under the License.
xml3.foo.@boo = "boo";
trace("baz? " + xml3.bar.baz);
trace("boo? " + xml3.foo.@boo);
+ var ampXML:XML = new XML("<Content>Bat & Ball</Content>");
+ var amp2XML:XML = new XML("<Content>Bat & Ball</Content>");
+ trace(ampXML.toXMLString());
+ trace(amp2XML.toXMLString());
+ trace("escaped ampersands should be equal? " + (ampXML.toXMLString() == amp2XML.toXMLString()));
+ trace("ampersand should not be escaped: " + ampXML.toString());
var child:XML = <pop><child name="Sam"/></pop>;
xml1.appendChild(child);
child = <pop><child name="George"/></pop>;
--
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <co...@royale.apache.org>'].