var test:XMLList = _siteXML..*.( re["test"]( attribute("name")));
[ and ] keeps compiler from warning when using the RegExp test() method
Pavel
On Jul 19, 2008, at 4:40 AM, Merrill, Jason wrote:
OK, I tried this out, but I get a compile-time error
"Warning: test is not a recognized method of the dynamic class
RegExp."
The code I have is:
var re:RegExp = new RegExp("^" + searchInput.text);
var xmlListSearch:XMLList = _model.help.helpData.xml..*.topic.*.(
re.test(attribute("title")));
trace("searchResult: " + xmlListSearch.toXMLString());
(note, _model.help.helpData.xml is the location of the loaded XML)
Jason Merrill
Bank of America
Enterprise Technology & Global Risk L&LD
Instructional Technology & Media
Join the Bank of America Flash Platform Developer Community
Are you a Bank of America associate interested in innovative learning
ideas and technologies?
Check out our internal GT&O Innovative Learning Blog & subscribe.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Wagner Amaral
Sent: Friday, July 18, 2008 5:04 PM
To: Flash Coders List
Subject: Re: [Flashcoders] XML deep searching
Hi Jason,
The error you're getting is actually syntatical. Here's what
you wrote:
re.(attribute())
And what you should've done:
re.test(attribute())
Since re is an object of type RegExp, you want to call the
method test() on it, and I guess it will work then
Also, I believe this is more concise:
xml..*.topic.
instead of:
xml.topics..topic.*.
Still, I've got a bizarre behaviour when testing this out,
I'll post a new thread shortly describing the problem.
Wagner
On Fri, Jul 18, 2008 at 4:48 PM, Merrill, Jason <
[EMAIL PROTECTED]> wrote:
OK, so based on what I just picked out of the "E4X, regexp and user
input" thread, I tried to mix some XML and a regex to solve my
problem, but I didn't get too far, and again, really don't
know what
I'm doing with regular expressions, and I'm not quite a pro at E4X
yet. I am getting this error when I try and search on [EMAIL PROTECTED]
attribute
values:
"Filter operator not supported on type RegExp."
based on this code:
var re:RegExp = new RegExp("^" + searchInput.text); var
xmlListSearch:XMLList = xml.topics..topic.*.( re.(
attribute("title")));
Which is drawing from this XML:
<data>
<topics>
<topic title="Coldplay's New Album" />
<topic title="The Dark Knight" />
<topic title="Arrested Development: The Movie" />
...etc.
Any ideas? Thanks.
Jason Merrill
Bank of America
Enterprise Technology & Global Risk L&LD Instructional Technology &
Media
Join the Bank of America Flash Platform Developer Community
Are you a Bank of America associate interested in
innovative learning
ideas and technologies?
Check out our internal GT&O Innovative Learning Blog & subscribe.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders