XMLList

/*下例创建名为 books 的 XML 属性

并将多个带有 book publisher 和 name 

标签的项添加到名为 books 的节点。

然后调用 showBooksByPublisher() 

方法,该方法接收 XMLList 

并返回与发行人“Addison-Wesley”

匹配的每一项。 */



var books:XML= <books>

               	  <book publisher="Addison-Wesley" name="Design Patterns" />

                  <book publisher="Addison-Wesley" name="The Pragmatic Programmer" />

                  <book publisher="Addison-Wesley" name="Test Driven Development" />

                  <book publisher="Addison-Wesley" name="Refactoring to Patterns" />

                  <book publisher="O'Reilly Media" name="The Cathedral & the Bazaar" />

                  <book publisher="O'Reilly Media" name="Unit Test Frameworks" />

              </books>;

					

showBooksByPublisher("Addison-Wesley");



function showBooksByPublisher(name:String):void

{

	var results:XMLList = books.book;

	showList(results);

	

}



function showList(list:XMLList):void

{

	var item:XML;

	for each (item in list)

	{



		trace("item: " + item.toXMLString());

	}

}

你可能感兴趣的:(list)