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 2019/06/24 09:24:13 UTC

[royale-asjs] branch develop updated: XMLList.toString() should contain the tags

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 66a7580  XMLList.toString() should contain the tags
66a7580 is described below

commit 66a7580dd0e234458f73d2ec4fac327011167010
Author: Harbs <ha...@in-tools.com>
AuthorDate: Mon Jun 24 12:24:00 2019 +0300

    XMLList.toString() should contain the tags
    
    (We should add a test for this)
---
 frameworks/projects/XML/src/main/royale/XMLList.as | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/frameworks/projects/XML/src/main/royale/XMLList.as b/frameworks/projects/XML/src/main/royale/XMLList.as
index 05d5861..10e91e1 100644
--- a/frameworks/projects/XML/src/main/royale/XMLList.as
+++ b/frameworks/projects/XML/src/main/royale/XMLList.as
@@ -1020,6 +1020,8 @@ package
 		 */
 		public function toString():String
 		{
+			if(isSingle())
+				return _xmlArray[0].toString();
 			var retVal:Array = [];
 			var len:int = _xmlArray.length;
 			var cumulativeText:String = '';
@@ -1027,17 +1029,16 @@ package
 			{
 				var str:String = _xmlArray[i].toString();
 				if (XML(_xmlArray[i]).nodeKind() == 'text') {
-					cumulativeText += str;
+					cumulativeText += _xmlArray[i].toString();
 				} else {
 					if (cumulativeText) {
-                        retVal.push(cumulativeText);
-                        cumulativeText = '';
+						retVal.push(cumulativeText);
+						cumulativeText = '';
 					}
-                    if(str)
-                        retVal.push(str);
+					retVal.push(_xmlArray[i].toXMLString());
 				}
 			}
-            if (cumulativeText) retVal.push(cumulativeText);
+			if (cumulativeText) retVal.push(cumulativeText);
 			return retVal.join("\n");
 		}