This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 738d58f9966d22b91a0bbce0eb9551a1dde338c0
Author: Alex Harui <[email protected]>
AuthorDate: Tue Sep 25 10:19:18 2018 -0700

    fix construction with XMLList literal.
---
 frameworks/projects/XML/src/main/royale/XMLList.as | 37 ++++++++++++++++++++--
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/XML/src/main/royale/XMLList.as 
b/frameworks/projects/XML/src/main/royale/XMLList.as
index ebf2e63..e3933ce 100644
--- a/frameworks/projects/XML/src/main/royale/XMLList.as
+++ b/frameworks/projects/XML/src/main/royale/XMLList.as
@@ -44,9 +44,40 @@ package
                        {
                                this[0] = expression;
                        }
-                       else
-                               this[0] = new XML(expression);
-               }
+                       else 
+            {
+                try
+                {
+                               this[0] = new XML(expression);
+                }
+                catch (e:Error)
+                {
+                    if (typeof(expression) === "string")
+                    {
+                        // try adding a wrapping node and then grab the 
children
+                        expression = "<root>" + expression + "</root>";
+                        try
+                        {
+                            var xml:XML = new XML(expression);
+                            var list:XMLList = xml.children();
+                            var m:int = list.length();
+                            for (var j:int = 0; j < m; j++)
+                            {
+                                this[j] = list[j];
+                            }
+                        }
+                        catch (e2:Error)
+                        {
+                            throw e; // throw original error
+                        }
+                        
+                    }
+                    else
+                        throw e;
+                }
+            }
+               }
+        
                private var _xmlArray:Array = [];
                /*
                        9.2.1.2 [[Put]] (P, V)

Reply via email to