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:58 UTC

[47/49] git commit: [flex-asjs] [refs/heads/develop] - Moved QName and Namespace to Core Bug fixes

Moved QName and Namespace to Core
Bug fixes


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

Branch: refs/heads/develop
Commit: 1eec8d8d2ee2cdc6186adb1de2a0da690cdec5bf
Parents: 62e69f5
Author: Harbs <ha...@in-tools.com>
Authored: Sun Apr 10 18:52:16 2016 +0300
Committer: Harbs <ha...@in-tools.com>
Committed: Sun Apr 10 18:52:16 2016 +0300

----------------------------------------------------------------------
 .../projects/Core/src/main/flex/Namespace.as    | 129 +++++++++++---
 frameworks/projects/Core/src/main/flex/QName.as | 167 +++++++++++++++---
 .../projects/XML/src/main/flex/Namespace.as     | 135 ---------------
 frameworks/projects/XML/src/main/flex/QName.as  | 169 -------------------
 frameworks/projects/XML/src/main/flex/XML.as    |   9 +-
 manualtests/XMLTest/src/MyInitialView.mxml      |   7 +-
 6 files changed, 262 insertions(+), 354 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1eec8d8d/frameworks/projects/Core/src/main/flex/Namespace.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/Namespace.as b/frameworks/projects/Core/src/main/flex/Namespace.as
index 305d88c..93f8eab 100644
--- a/frameworks/projects/Core/src/main/flex/Namespace.as
+++ b/frameworks/projects/Core/src/main/flex/Namespace.as
@@ -16,35 +16,120 @@
 //  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////
-package {
-
-/**
- *  Namespace implementation for JS
- */
-public class Namespace
+package
 {
-    public function Namespace(param1:*, param2:* = undefined)
+	public class Namespace
 	{
-		if (param2 !== undefined)
+		COMPILE::JS
+    	public function Namespace(prefixOrUri:Object=null,uriValue:Object=null)
 		{
-			uri = param2;
-			prefix = param1;
+			/*
+				When the Namespace constructor is called with a no arguments, one argument uriValue or two arguments prefixValue and uriValue, the following steps are taken:
+				1. Create a new Namespace object n
+				2. If prefixValue is not specified and uriValue is not specified
+				  a. Let n.prefix be the empty string
+				  b. Let n.uri be the empty string
+				3. Else if prefixValue is not specified
+				  a. If Type(uriValue) is Object and uriValue.[[Class]] == "Namespace"
+				    i. Let n.prefix = uriValue.prefix
+				    ii. Let n.uri = uriValue.uri
+				  b. Else if Type(uriValue) is Object and uriValue.[[Class]] == "QName" and uriValue.uri is not null
+				    i. Let n.uri = uriValue.uri NOTE implementations that preserve prefixes in qualified names may also set n.prefix = uriValue.[[Prefix]]
+				  c. Else
+				    i. Let n.uri = ToString(uriValue)
+				    ii. If (n.uri is the empty string), let n.prefix be the empty string
+				    iii. Else n.prefix = undefined
+				4. Else
+				  a. If Type(uriValue) is Object and uriValue.[[Class]] == "QName" and uriValue.uri is not null
+				    i. Let n.uri = uriValue.uri
+				  b. Else
+				    i. Let n.uri = ToString(uriValue)
+				  c. If n.uri is the empty string
+				    i. If prefixValue is undefined or ToString(prefixValue) is the empty string
+				      1. Let n.prefix be the empty string
+				    ii. Else throw a TypeError exception
+				  d. Else if prefixValue is undefined, let n.prefix = undefined
+				  e. Else if isXMLName(prefixValue) == false
+				  i. Let n.prefix = undefined
+				  f. Else let n.prefix = ToString(prefixValue)
+				5. Return n
+			*/
+			if(!uriValue && prefixOrUri) //we don't have a prefix defined
+			{
+				var uriVal:Object = uriValue ? uriValue : prefixOrUri;
+				if(uriVal is Namespace)
+				{
+					_prefix = (uriVal as Namespace).prefix;
+					_uri = (uriVal as Namespace).uri;
+				}
+				else if(uriVal is QName)
+				{
+					if((uriVal as QName).uri)
+						_uri = (uriVal as QName).uri;
+				}
+				else {
+					_uri = uriVal.toString();
+					if(_uri == "")
+						_prefix = "";
+				}
+			}
+			else if(uriValue)
+			{
+				// something is specified as the URI otherwise fall through and leave both the prefix and uri blank
+				if(uriValue is QName)
+				{
+					if((uriValue as QName).uri)
+						_uri = (uriValue as QName).uri;
+				}
+				else {
+					_uri = uriValue.toString();
+				}
+
+				if(!_uri)
+				{
+					if(!prefixOrUri)
+						_prefix = "";
+					else
+						throw new TypeError("invalid prefix");
+				}
+				else
+					_prefix = prefixOrUri.toString();
+
+			}
 		}
-		else
+
+		private var _uri:String = "";
+		public function get uri():String
 		{
-			uri = param1;
+			return _uri;
+		}
+		public function set uri(value:String):void
+		{
+			_uri = value;
+		}
+		
+		private var _prefix:String = null;
+		public function get prefix():String
+		{
+			return _prefix;
+		}
+		public function set prefix(value:String):void
+		{
+			_prefix = value;
+		}
+
+		COMPILE::JS
+		public function toString():String
+		{
+			return uri;
+		}
+
+		COMPILE::JS
+		override public function valueOf():*
+		{
+			return this;
 		}
 	}
-	
-	public var uri:String;
-	public var prefix:String;
-	
-	public function toString():String
-	{
-		return uri;
-	}
-	
 }
 
-}
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1eec8d8d/frameworks/projects/Core/src/main/flex/QName.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/QName.as b/frameworks/projects/Core/src/main/flex/QName.as
index 26c398b..057b9d5 100644
--- a/frameworks/projects/Core/src/main/flex/QName.as
+++ b/frameworks/projects/Core/src/main/flex/QName.as
@@ -16,38 +16,155 @@
 //  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////
-package {
-
-/**
- *  QName implementation for JS
- */
-public class QName
+package
 {
-    public function QName(param1:Object, localName:String = null)
+	public class QName
 	{
-		if (param1 is QName)
+		COMPILE::JS
+		public function QName(qNameOrUri:*=null,localNameVal:*=null)
 		{
-			var q:QName = param1 as QName;
-			uri = q.uri;
-			localName = q.localName;
+			/*
+				When the QName constructor is called with a one argument Name or two arguments Namespace and Name the following steps are taken:
+				1. If (Type(Name) is Object and Name.[[Class]] == "QName")
+				  a. If (Namespace is not specified), return a copy of Name
+				  b. Else let Name = Name.localName
+				2. If (Name is undefined or not specified)
+				  a. Let Name = “”
+				3. Else let Name = ToString(Name)
+				4. If (Namespace is undefined or not specified)
+				  a. If Name = "*"
+				    i. Let Namespace = null
+				  b. Else
+				    i. Let Namespace = GetDefaultNamespace()
+				5. Let q be a new QName with q.localName = Name
+				6. If Namespace == null
+				  a. Let q.uri = null NOTE implementations that preserve prefixes in qualified names may also set q.[[Prefix]] to undefined
+				7. Else
+				  a. Let Namespace be a new Namespace created as if by calling the constructor new Namespace(Namespace)
+				  b. Let q.uri = Namespace.uri NOTE implementations that preserve prefixes in qualified names may also set q.[[Prefix]] to Namespace.prefix
+				8. Return q
+			*/
+			if(qNameOrUri is QName)
+			{
+				_uri = qNameOrUri.uri;
+				_localName = qNameOrUri.localName;
+				_prefix = qNameOrUri.prefix;
+			}
+			else if(qNameOrUri is Namespace)
+			{
+				_uri = (qNameOrUri as Namespace).uri;
+				_prefix = (qNameOrUri as Namespace).prefix;
+				if(localNameVal)
+					_localName = localNameVal.toString();
+			}
+			else if(localNameVal)
+			{
+				_localName = localNameVal;
+				_uri = qNameOrUri;
+			}
+			else if (qNameOrUri && qNameOrUri.toString())
+			{
+				_localName = qNameOrUri.toString();
+			}
 		}
-		else if (param1 is Namespace)
+
+		private var _uri:String;
+		public function get uri():String
 		{
-			var n:Namespace = param1 as Namespace;
-			uri = n.uri;
-			this.localName = localName;
+			return _uri;
 		}
+		public function set uri(value:String):void
+		{
+			_uri = value;
+		}
+		
+		private var _localName:String;
+		public function get localName():String
+		{
+			return _localName;
+		}
+		public function set localName(value:String):void
+		{
+			_localName = value;
+		}
+
+		private var _prefix:String;
+		public function get prefix():String
+		{
+			return _prefix;
+		}
+		public function set prefix(value:String):void
+		{
+			_prefix = value;
+		}
+
+		COMPILE::JS
+		public function toString():String
+		{
+			var uriVal:String = _uri ? _uri : "*";
+			return uriVal + "::" + _localName;
+		}
+
+		COMPILE::JS
+		public function equals(name:QName):Boolean
+		{
+			return this.uri == name.uri && this.localName == name.localName; // this.prefix == name.prefix &&
+		}
+		
+    	COMPILE::JS
+		public function matches(name:QName):Boolean
+		{
+			if(this.uri == "*" || name.uri == "*")
+				return this.localName == "*" || name.localName == "*" || this.localName == name.localName;
+
+			if(this.localName == "*" || name.localName == "*")
+				return this.uri == name.uri;
+
+			return this.uri == name.uri && this.localName == name.localName;
+		}
+		private var _isAttribute:Boolean;
+		public function get isAttribute():Boolean
+		{
+			return _isAttribute;
+		}
+		public function set isAttribute(value:Boolean):void
+		{
+			_isAttribute = value;
+		}
+
+		COMPILE::JS
+		public function getNamespace(namespaces:Array=null):Namespace
+		{
+			/*
+				When the [[GetNamespace]] method of a QName q is called with no arguments or one argument InScopeNamespaces, the following steps are taken:
+				1. If q.uri is null, throw a TypeError exception NOTE the exception above should never occur due to the way [[GetNamespace]] is called in this specification
+				2. If InScopeNamespaces was not specified, let InScopeNamespaces = { }
+				3. Find a Namespace ns in InScopeNamespaces, such that ns.uri == q.uri. If more than one such Namespace ns exists, the implementation may choose one of the matching Namespaces arbitrarily. NOTE implementations that preserve prefixes in qualified names may additionally constrain ns, such that ns.prefix == q.[[Prefix]]
+				4. If no such namespace ns exists
+				a. Let ns be a new namespace created as if by calling the constructor new Namespace(q.uri) NOTE implementations that preserve prefixes and qualified names may create the new namespaces as if by calling the constructor Namespace(q.[[Prefix]], q.uri)
+				5. Return ns
+			*/
+			var i:int;
+			var possibleMatch:Namespace;
+			if(!namespaces)
+				namespaces = [];
+			for(i=0;i<namespaces.length;i++)
+			{
+				if(namespaces[i].uri == _uri)
+				{
+					possibleMatch = namespaces[i];
+					if(namespaces[i].prefix == _prefix)
+						return namespaces[i];
+				}
+			}
+			if(possibleMatch)
+				return possibleMatch;
+			if(!_prefix)
+				return new Namespace(_uri);
+			return new Namespace(_prefix,_uri);
+		}
+
 	}
-	
-	public var uri:String;
-	public var localName:String;
-	
-	public function toString():String
-	{
-		return uri + "::" + localName;
-	}
-	
 }
 
-}
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1eec8d8d/frameworks/projects/XML/src/main/flex/Namespace.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/XML/src/main/flex/Namespace.as b/frameworks/projects/XML/src/main/flex/Namespace.as
deleted file mode 100644
index 93f8eab..0000000
--- a/frameworks/projects/XML/src/main/flex/Namespace.as
+++ /dev/null
@@ -1,135 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  Licensed to the Apache Software Foundation (ASF) under one or more
-//  contributor license agreements.  See the NOTICE file distributed with
-//  this work for additional information regarding copyright ownership.
-//  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
-//  the License.  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package
-{
-	public class Namespace
-	{
-		COMPILE::JS
-    	public function Namespace(prefixOrUri:Object=null,uriValue:Object=null)
-		{
-			/*
-				When the Namespace constructor is called with a no arguments, one argument uriValue or two arguments prefixValue and uriValue, the following steps are taken:
-				1. Create a new Namespace object n
-				2. If prefixValue is not specified and uriValue is not specified
-				  a. Let n.prefix be the empty string
-				  b. Let n.uri be the empty string
-				3. Else if prefixValue is not specified
-				  a. If Type(uriValue) is Object and uriValue.[[Class]] == "Namespace"
-				    i. Let n.prefix = uriValue.prefix
-				    ii. Let n.uri = uriValue.uri
-				  b. Else if Type(uriValue) is Object and uriValue.[[Class]] == "QName" and uriValue.uri is not null
-				    i. Let n.uri = uriValue.uri NOTE implementations that preserve prefixes in qualified names may also set n.prefix = uriValue.[[Prefix]]
-				  c. Else
-				    i. Let n.uri = ToString(uriValue)
-				    ii. If (n.uri is the empty string), let n.prefix be the empty string
-				    iii. Else n.prefix = undefined
-				4. Else
-				  a. If Type(uriValue) is Object and uriValue.[[Class]] == "QName" and uriValue.uri is not null
-				    i. Let n.uri = uriValue.uri
-				  b. Else
-				    i. Let n.uri = ToString(uriValue)
-				  c. If n.uri is the empty string
-				    i. If prefixValue is undefined or ToString(prefixValue) is the empty string
-				      1. Let n.prefix be the empty string
-				    ii. Else throw a TypeError exception
-				  d. Else if prefixValue is undefined, let n.prefix = undefined
-				  e. Else if isXMLName(prefixValue) == false
-				  i. Let n.prefix = undefined
-				  f. Else let n.prefix = ToString(prefixValue)
-				5. Return n
-			*/
-			if(!uriValue && prefixOrUri) //we don't have a prefix defined
-			{
-				var uriVal:Object = uriValue ? uriValue : prefixOrUri;
-				if(uriVal is Namespace)
-				{
-					_prefix = (uriVal as Namespace).prefix;
-					_uri = (uriVal as Namespace).uri;
-				}
-				else if(uriVal is QName)
-				{
-					if((uriVal as QName).uri)
-						_uri = (uriVal as QName).uri;
-				}
-				else {
-					_uri = uriVal.toString();
-					if(_uri == "")
-						_prefix = "";
-				}
-			}
-			else if(uriValue)
-			{
-				// something is specified as the URI otherwise fall through and leave both the prefix and uri blank
-				if(uriValue is QName)
-				{
-					if((uriValue as QName).uri)
-						_uri = (uriValue as QName).uri;
-				}
-				else {
-					_uri = uriValue.toString();
-				}
-
-				if(!_uri)
-				{
-					if(!prefixOrUri)
-						_prefix = "";
-					else
-						throw new TypeError("invalid prefix");
-				}
-				else
-					_prefix = prefixOrUri.toString();
-
-			}
-		}
-
-		private var _uri:String = "";
-		public function get uri():String
-		{
-			return _uri;
-		}
-		public function set uri(value:String):void
-		{
-			_uri = value;
-		}
-		
-		private var _prefix:String = null;
-		public function get prefix():String
-		{
-			return _prefix;
-		}
-		public function set prefix(value:String):void
-		{
-			_prefix = value;
-		}
-
-		COMPILE::JS
-		public function toString():String
-		{
-			return uri;
-		}
-
-		COMPILE::JS
-		override public function valueOf():*
-		{
-			return this;
-		}
-	}
-}
-
-

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1eec8d8d/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
deleted file mode 100644
index 70298f9..0000000
--- a/frameworks/projects/XML/src/main/flex/QName.as
+++ /dev/null
@@ -1,169 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  Licensed to the Apache Software Foundation (ASF) under one or more
-//  contributor license agreements.  See the NOTICE file distributed with
-//  this work for additional information regarding copyright ownership.
-//  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
-//  the License.  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package
-{
-	public class QName
-	{
-		COMPILE::JS
-		public function QName(qNameOrUri:*=null,localNameVal:*=null)
-		{
-			/*
-				When the QName constructor is called with a one argument Name or two arguments Namespace and Name the following steps are taken:
-				1. If (Type(Name) is Object and Name.[[Class]] == "QName")
-				  a. If (Namespace is not specified), return a copy of Name
-				  b. Else let Name = Name.localName
-				2. If (Name is undefined or not specified)
-				  a. Let Name = “”
-				3. Else let Name = ToString(Name)
-				4. If (Namespace is undefined or not specified)
-				  a. If Name = "*"
-				    i. Let Namespace = null
-				  b. Else
-				    i. Let Namespace = GetDefaultNamespace()
-				5. Let q be a new QName with q.localName = Name
-				6. If Namespace == null
-				  a. Let q.uri = null NOTE implementations that preserve prefixes in qualified names may also set q.[[Prefix]] to undefined
-				7. Else
-				  a. Let Namespace be a new Namespace created as if by calling the constructor new Namespace(Namespace)
-				  b. Let q.uri = Namespace.uri NOTE implementations that preserve prefixes in qualified names may also set q.[[Prefix]] to Namespace.prefix
-				8. Return q
-			*/
-			if(qNameOrUri is QName)
-			{
-				_uri = qNameOrUri.uri;
-				_localName = qNameOrUri.localName;
-				_prefix = qNameOrUri.prefix;
-			}
-			else if(qNameOrUri is Namespace)
-			{
-				_uri = (qNameOrUri as Namespace).uri;
-				_prefix = (qNameOrUri as Namespace).prefix;
-				if(localNameVal)
-					_localName = localNameVal.toString();
-			}
-			else if(localNameVal)
-			{
-				_localName = localNameVal;
-			}
-			else if (qNameOrUri && qNameOrUri.toString())
-			{
-				_localName = qNameOrUri.toString();
-			}
-		}
-
-		private var _uri:String;
-		public function get uri():String
-		{
-			return _uri;
-		}
-		public function set uri(value:String):void
-		{
-			_uri = value;
-		}
-		
-		private var _localName:String;
-		public function get localName():String
-		{
-			return _localName;
-		}
-		public function set localName(value:String):void
-		{
-			_localName = value;
-		}
-
-		private var _prefix:String;
-		public function get prefix():String
-		{
-			return _prefix;
-		}
-		public function set prefix(value:String):void
-		{
-			_prefix = value;
-		}
-
-		COMPILE::JS
-		public function toString():String
-		{
-			var uriVal:String = _uri ? _uri : "*";
-			return uriVal + "::" + _localName;
-		}
-
-		COMPILE::JS
-		public function equals(name:QName):Boolean
-		{
-			return this.uri == name.uri && this.localName == name.localName; // this.prefix == name.prefix &&
-		}
-		
-    	COMPILE::JS
-		public function matches(name:QName):Boolean
-		{
-			if(this.uri == "*" || name.uri == "*")
-				return this.localName == "*" || name.localName == "*" || this.localName == name.localName;
-
-			if(this.localName == "*" || name.localName == "*")
-				return this.uri == name.uri;
-
-			return this.uri == name.uri && this.localName == name.localName;
-		}
-		private var _isAttribute:Boolean;
-		public function get isAttribute():Boolean
-		{
-			return _isAttribute;
-		}
-		public function set isAttribute(value:Boolean):void
-		{
-			_isAttribute = value;
-		}
-
-		COMPILE::JS
-		public function getNamespace(namespaces:Array=null):Namespace
-		{
-			/*
-				When the [[GetNamespace]] method of a QName q is called with no arguments or one argument InScopeNamespaces, the following steps are taken:
-				1. If q.uri is null, throw a TypeError exception NOTE the exception above should never occur due to the way [[GetNamespace]] is called in this specification
-				2. If InScopeNamespaces was not specified, let InScopeNamespaces = { }
-				3. Find a Namespace ns in InScopeNamespaces, such that ns.uri == q.uri. If more than one such Namespace ns exists, the implementation may choose one of the matching Namespaces arbitrarily. NOTE implementations that preserve prefixes in qualified names may additionally constrain ns, such that ns.prefix == q.[[Prefix]]
-				4. If no such namespace ns exists
-				a. Let ns be a new namespace created as if by calling the constructor new Namespace(q.uri) NOTE implementations that preserve prefixes and qualified names may create the new namespaces as if by calling the constructor Namespace(q.[[Prefix]], q.uri)
-				5. Return ns
-			*/
-			var i:int;
-			var possibleMatch:Namespace;
-			if(!namespaces)
-				namespaces = [];
-			for(i=0;i<namespaces.length;i++)
-			{
-				if(namespaces[i].uri == _uri)
-				{
-					possibleMatch = namespaces[i];
-					if(namespaces[i].prefix == _prefix)
-						return namespaces[i];
-				}
-			}
-			if(possibleMatch)
-				return possibleMatch;
-			if(!_prefix)
-				return new Namespace(_uri);
-			return new Namespace(_prefix,_uri);
-		}
-
-	}
-}
-
-

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1eec8d8d/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 93ba2b1..c3f212c 100644
--- a/frameworks/projects/XML/src/main/flex/XML.as
+++ b/frameworks/projects/XML/src/main/flex/XML.as
@@ -183,12 +183,15 @@ package
 			var xml:XML;
 			var i:int;
 			var data:* = node.nodeValue;
+			var qname:QName = new QName(node.namespaceURI,node.nodeName);
+			qname.prefix = node.prefix;
 			switch(node.nodeType)
 			{
 				case 1:
 					//ELEMENT_NODE
 					xml = new XML();
 					xml.setNodeKind("element");
+					xml.setName(qname);
 					iterateElement(node,xml);
 					break;
 				//case 2:break;// ATTRIBUTE_NODE (handled separately)
@@ -196,11 +199,13 @@ package
 					//TEXT_NODE
 					xml = new XML();
 					xml.setNodeKind("text");
+					xml.setName(qname);
 					xml.setValue(data);
 					break;
 				case 4:
 					//CDATA_SECTION_NODE
 					xml = new XML();
+					xml.setName(qname);
 					xml.setNodeKind("text");
 					data = "<![CDATA[" + data + "]]>";
 					xml.setValue(data);
@@ -211,7 +216,7 @@ package
 					//PROCESSING_INSTRUCTION_NODE
 					xml = new XML();
 					xml.setNodeKind("processing-instruction");
-					xml.setName(node.nodeName);
+					xml.setName(qname);
 					xml.setValue(data);
 					break;
 				case 8:
@@ -563,7 +568,7 @@ package
 			*/
 			var i:int;
 			var list:XMLList = new XMLList();
-			if(parseInt(name,10).toString() == propertyName)
+			if(parseInt(propertyName,10).toString() == propertyName)
 			{
 				if(propertyName != "0")
 					return null;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1eec8d8d/manualtests/XMLTest/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/manualtests/XMLTest/src/MyInitialView.mxml b/manualtests/XMLTest/src/MyInitialView.mxml
index e57a0fc..34de79a 100644
--- a/manualtests/XMLTest/src/MyInitialView.mxml
+++ b/manualtests/XMLTest/src/MyInitialView.mxml
@@ -50,7 +50,12 @@ limitations under the License.
                 trace(xml1.toXMLString() == '<foo baz="true"/>');
                 var baz:XMLList = xml1.@baz;
                 trace("baz: " + xml1.@baz.toString() + " //true");
-
+                var child:XML = <pop><child name="Sam"/></pop>;
+                xml1.appendChild(child);
+                child = new XML('<pop><child name="George"/></pop>');
+                xml1.appendChild(child);
+                trace(xml1.pop[0].toString());
+                trace(xml1.pop[1].toString());
             }
 		]]>
 	</fx:Script>