Surprised this didn't error before.

 

All e4x expressions reuturn an XMLList, even if there is only one node.
So you have to do:

x = srv.lastResult.Term.Department.(@id==cDept).Course.(@num==cCrs)[0];
//to get the one and only XML node

Tracy

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of kenny14390
Sent: Friday, June 27, 2008 7:54 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] XMLList -> XML Spontaneous Error

 

Code that I haven't touched in months is now giving me errors at
runtime. It's compiling without even a warning, but when the
application is run, I get unexpected results. When I run the app in
debug mode, all breakpoints are ignored (news to me) so it's difficult
to find exactly what's wrong. I get the following error:

TypeError: Error #1034: Type Coercion failed: cannot convert
[EMAIL PROTECTED] to XML.
at Schedule/setWorkingCourse()[C:\Documents and Settings\Ricky\My
Documents\CS\Flex Projects\DDVSB2\src\Schedule.mxml:1286]...

So I went to that line and I found absolutely nothing wrong:

x = srv.lastResult.Term.Department.(@id==cDept).Course.(@num==cCrs);

x is defined a few lines up as x:XML. srv is the HTTPService that is
called upon creationComplete, and it is working just fine with the
rest of the application. cDept and cCrs are working fine as well.
Here's an example of the code that I'm trying to assign to x:

<Course dept="ARTH" j="4" num="287A" name="Topics In Modern Art"
credits="4.000" gened="W Writing (Harpur Req)">
<Section id="01" dept="ARTH" select="" num="287A" crn="92468"
days="MW" time="15:30-16:55" instr="TBA" place="FA 258" capacity="84">
<Config>Discussion</Config>
</Section>
<length>1</length>
</Course>

That looks like valid XML to me! Apparently, it's an XMLList and that
is unable to be coerced to type XML. It's only been doing that for the
past few months with no problem. What could be the problem? Why is
Flex being so weird?

 

Reply via email to