You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2016/04/11 00:48:54 UTC

[43/49] git commit: [flex-asjs] [refs/heads/develop] - First working E4X test

First working E4X test


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/5d2d0dd4
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/5d2d0dd4
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/5d2d0dd4

Branch: refs/heads/develop
Commit: 5d2d0dd43410072734f7ae164f1a487260d471ad
Parents: ff4cf69
Author: Harbs <ha...@in-tools.com>
Authored: Sun Apr 10 15:53:07 2016 +0300
Committer: Harbs <ha...@in-tools.com>
Committed: Sun Apr 10 15:53:07 2016 +0300

----------------------------------------------------------------------
 frameworks/projects/XML/src/main/flex/QName.as |  8 ++++---
 frameworks/projects/XML/src/main/flex/XML.as   | 23 ++++++++++++++-------
 manualtests/XMLTest/src/MyInitialView.mxml     |  5 +++--
 3 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5d2d0dd4/frameworks/projects/XML/src/main/flex/QName.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/XML/src/main/flex/QName.as b/frameworks/projects/XML/src/main/flex/QName.as
index bfd7b40..c6886aa 100644
--- a/frameworks/projects/XML/src/main/flex/QName.as
+++ b/frameworks/projects/XML/src/main/flex/QName.as
@@ -57,11 +57,13 @@ package
 				if(localNameVal)
 					_localName = localNameVal.toString();
 			}
+			else if(localNameVal)
+			{
+				_localName = localNameVal;
+			}
 			else if (qNameOrUri && qNameOrUri.toString())
 			{
-				_uri = qNameOrUri.toString();
-				if(localNameVal)
-					_localName = localNameVal;
+				_localName = qNameOrUri.toString();
 			}
 		}
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5d2d0dd4/frameworks/projects/XML/src/main/flex/XML.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/XML/src/main/flex/XML.as b/frameworks/projects/XML/src/main/flex/XML.as
index 86a3ed1..b2222b6 100644
--- a/frameworks/projects/XML/src/main/flex/XML.as
+++ b/frameworks/projects/XML/src/main/flex/XML.as
@@ -329,6 +329,10 @@ package
 				var node:Element = doc.childNodes[0];
 				_version = doc.xmlVersion;
 				_encoding = doc.xmlEncoding;
+				_name = new QName();
+				_name.prefix = node.prefix;
+				_name.uri = node.namespaceURI;
+				_name.localName = node.localName;
 				iterateElement(node,this);
 				normalize();
 			}
@@ -2257,16 +2261,19 @@ package
 			//attributes and namespace declarations... (15-16)
 			for(i=0;i<declarations.length;i++)
 			{
-				strArr.push(" xmlns");
-				if(declarations[i].prefix)
+				var decVal:String = escapeAttributeValue(declarations[i].uri);
+				if(decVal)
 				{
-					strArr.push(":");
-					strArr.push(declarations[i].prefix);
+					strArr.push(" xmlns");
+					if(declarations[i].prefix)
+					{
+						strArr.push(":");
+						strArr.push(declarations[i].prefix);
+					}
+					strArr.push('="');
+					strArr.push(decVal);
+					strArr.push('"');
 				}
-				strArr.push('="');
-				strArr.push(escapeAttributeValue(declarations[i].uri));
-				strArr.push('"');
-
 			}
 			for(i=0;i<_attributes.length;i++)
 			{

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5d2d0dd4/manualtests/XMLTest/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/manualtests/XMLTest/src/MyInitialView.mxml b/manualtests/XMLTest/src/MyInitialView.mxml
index c611565..8d2fff5 100644
--- a/manualtests/XMLTest/src/MyInitialView.mxml
+++ b/manualtests/XMLTest/src/MyInitialView.mxml
@@ -46,8 +46,9 @@ limitations under the License.
                 var j:int;
                 var m:int;
                 var xml1:XML = <foo baz="true"/>;
-                trace(xml1);
-                trace(xml1.baz);
+                trace(xml1.toXMLString());
+                var baz:XMLList = xml1.@baz;
+                trace(xml1.@baz.toString());
 
             }
 		]]>