Sorry guys newbie here.
this is my code:
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("faculty_data.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void
{
var xml:XML = XML(event.target.data);
var result1:String = xml.faculty.(@Wordlookup.match(/Sanchez/)).college.toString();
trace(result1);
trace output ---> <college>COB</college>
---> <college>COE</college>
but I want an output like this: COB COE
Hope someone can help me... I did try to Google it...
sorry here's my XML
<facultylist>
<faculty Wordlookup="Maria Rosario">
<id>1</id>
<fullName>Maria Rosario</fullName>
<college>CED </college>
<department>ELMD</department>
</faculty>
<faculty Wordlookup="Liza Sanchez">
<id>2</id>
<fullName>Lysa Sanchez</fullName>
<college>CED </college>
<department>Marketing</department>
</faculty>
<faculty Wordlookup="Melany Sanchez">
<id>3</id>
<fullName>Melany Sanchez</fullName>
<college>CLA </college>
<department>Marketing</department>
</faculty>
</facultylist>
I do not know how your XML look like, but I presume you also filter for @Wordlookup == "Sanchez".
Could you please try this:
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("faculty_data.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void
{
var xml:XML = XML(event.target.data);
var lstXML:XMLList = xml.faculty.(@Wordlookup.match(/Sanchez/)).college;
for each(var child:XML in lstXML)
{
trace(String(child));
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.