I always advise working up complex expressions slowly, tracing
toXMLString() at each step to be sure you are still going correctly.
private function photoDataHandler(event:ResultEvent):void{
var xmlResult:XML =XML(event.result)
trace(xmlResult.toXMLString());
var xlTemp:XMLList = xmlResult.getBronnenResult;
trace(xlTemp.toXMLString()); //if this doesn't work you probably
have a namespace issue
//then continue building the expression checking as you go.
}
In fact, I suspect you have a namespace issue. It looks like your xml
has a default namespace:
xmlns="http://tempuri.org/ <http://tempuri.org/> "
I suspect you need to declare this. I always forget the exact syntax.
Tracy
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Douglas Knudsen
Sent: Friday, June 06, 2008 8:31 PM
To: [email protected]
Subject: Re: [flexcoders] webservice e4x-result can not be filtered??
why? use e4x, eh?
have a look at http://livedocs.adobe.com/flex/3/langref/XML.html
<http://livedocs.adobe.com/flex/3/langref/XML.html>
there are examples at this URL of searching/matching using e4x
DK
On Fri, Jun 6, 2008 at 3:57 PM, mariovandeneynde
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote:
Greetings!
I have the following situation:
[Application]
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
layout="absolute" creationComplete="this.croplifedata.getBronnen.send
()">
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.rpc.events.ResultEvent;
import mx.rpc.soap.*;
private namespace webNameSpace
= "http://tempuri.org/ <http://tempuri.org/> ";
use namespace webNameSpace;
[Bindable]
public var sKeyWord:String = "biotechnology";
[Bindable]
public var sMediaTypes:String = "1,2";
[Bindable]
public var sMediaSubTypes:String = "1,2,3";
public function photoDataHandler
(event:ResultEvent):void{
trace(event.result);
}
]]>
</mx:Script>
<mx:WebService wsdl="http://xxx.xxx.xxx.xx/getData.asmx?
<http://xxx.xxx.xxx.xx/getData.asmx?>
wsdl" id="croplifedata" useProxy="false" showBusyCursor="false">
<mx:operation name="getBronnen" resultFormat="e4x"
result="photoDataHandler(event);">
<mx:request>
<sSearchKeyword>
{this.sKeyWord}</sSearchKeyword>
<sMediaTypes>
{this.sMediaTypes}</sMediaTypes>
<sMediaSubTypes>
{this.sMediaSubTypes}</sMediaSubTypes>
<lang>en</lang>
<cust>1</cust>
</mx:request>
</mx:operation>
</mx:WebService>
</mx:Application>
[/Application]
this gives me the following xml:
<getBronnenResponse xmlns="http://tempuri.org/ <http://tempuri.org/> "
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> "
xmlns:xsd="http://www.w3.org/2001/XMLSchema
<http://www.w3.org/2001/XMLSchema> ">
<getBronnenResult>
<Bronnen>
<id>81</id>
<sCount>260</sCount>
<title>Plant grown from cell culture tissue in test tube</title>
<number>100121</number>
<width>180</width>
<height>134</height>
</Bronnen>
<Bronnen>
<id>83</id>
<sCount>260</sCount>
<title>Scientist observing test plants</title>
<number>100123</number>
<width>180</width>
<height>180</height>
</Bronnen>
</getBronnenResult>
</getBronnenResponse>
Now, my question:
How can I convert this result to a xml/xmllist/...on wich I can
filter?
for example getBronnenResult.Bronnen.(child(id).toString() == '83');
I just can't get this to work...
thanks you for the ones who can help!
--
Douglas Knudsen
http://www.cubicleman.com <http://www.cubicleman.com>
this is my signature, like it?