The following works for me:
===================================================
var myXMLList:XMLList = XMLList(<GetUserProfileByNameResponse
xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetUserProfileByNameResult>
<PropertyData>
<Value>HelloWorld 1</Value>
</PropertyData>
<PropertyData>
<Value>HelloWorld 2</Value>
</PropertyData>
</GetUserProfileByNameResult>
</GetUserProfileByNameResponse>);
var pnNs:Namespace=new
Namespace("http://microsoft.com/webservices/SharePointPortalServer/UserProfileService");
var myXMLList2:XMLList = myXMLList.pnNs::GetUserProfileByNameResult;
for each (var node:XML in myXMLList2.pnNs::PropertyData) {
trace(" - PropertyData: ", node.toXMLString());
}
===================================================
regards,
Muzak
----- Original Message -----
From: "Merrill, Jason" <jason.merr...@bankofamerica.com>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Friday, April 29, 2011 4:32 AM
Subject: [Flashcoders] XMLList & Namespace Madness
I'm going crazy trying to drill down into a XMLList which has namespaces declared. I have been able to go into a few layers of the
original XML with namespaces using namespace definitions in AS3, but now I am stuck at the last level.
The XMLList I have pared it down to has a length of 1 and has namespaces declared, which is throwing things off. How can I get to
the <PropertyData /> nodes given that namespaces are involved?
The following code can be copied and pasted into a fresh .fla as a test case:
/*--------------------TEST CASE-------------------------*/
var myXMLList:XMLList = XMLList(<GetUserProfileByNameResponse
xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetUserProfileByNameResult>
<PropertyData>
<Value>HelloWorld 1</Value>
</PropertyData>
<PropertyData>
<Value>HelloWorld 1</Value>
</PropertyData>
</GetUserProfileByNameResult>
</GetUserProfileByNameResponse>);
var pnNs:Namespace = new
Namespace("http://microsoft.com/webservices/SharePointPortalServer/UserProfileService");
var myXMLList2:XMLList = myXMLList.pnNs::GetUserProfileByNameResult;
trace("myXMLList2: "+myXMLList2)//Traces fine, except more namespaces (xmlns)
appear as attributes in first node.
for each (var propertyDataXML:XML in myXMLList2..PropertyData)
{
//WHY DOES THIS NOT TRACE?
trace("propertyDataXML: "+propertyDataXML);
}
/*------------------------------------------------------*/
I also tried this for the loop as well:
/*------------------------------------------------------*/
for each (var propertyDataXML2:XML in
myXMLList2.pnNs::GetUserProfileByNameResult..PropertyData)
{
//WHY DOES THIS NOT TRACE?
trace("propertyDataXML: "+propertyDataXML2);
}
/*------------------------------------------------------*/
And why does the trace on myXMLList2 show an XML list where there is more namespace applied: "<GetUserProfileByNameResponse
xmlns=http://microsoft.com/webservices/SharePointPortalServer/UserProfileService..." ??
Any help is MUCH appreciated.
Jason Merrill
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders