RE: [Flashcoders] E4X filtering strange behaviour

2008-07-22 Thread Merrill, Jason
That was it, it works now, thanks. Funny, I didn't notice that, I had it in my code before, but somewhere along the line of messing with things, it just switched back over to .toString() and I hadn't noticed. Thanks everyone! One more question if I may - how can I exclude certain things like

Re: [Flashcoders] E4X filtering strange behaviour

2008-07-22 Thread Kenneth Kawamoto
I could be wrong but that (user input validation) should be done prior to RegExp construction. Kenneth Kawamoto http://www.materiaprima.co.uk/ Merrill, Jason wrote: That was it, it works now, thanks. Funny, I didn't notice that, I had it in my code before, but somewhere along the line of

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Merrill, Jason
Ah, I know where the confusion came from, you said the code was based on my example, but that was actually Wagner's example, where he put var test:XML = data...etc. (it was based on my example, but he used test as an instance of the XML when requoting my original question) The use of test as the

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Merrill, Jason
PROTECTED] On Behalf Of Kenneth Kawamoto Sent: Saturday, July 19, 2008 6:19 AM To: Flash Coders List Subject: Re: [Flashcoders] E4X filtering strange behaviour The code was based on your example and therefore we know the XML schema, i.e. we know the node name and they all have the attribute title

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Merrill, Jason
: Monday, July 21, 2008 10:08 AM To: Flash Coders List Subject: RE: [Flashcoders] E4X filtering strange behaviour Also this is shorter: var xmlListSearch:XMLList = test..topic.(re.test(@title)); If we don't know anything about the XML we could do something like: var xmlListSearch:XMLList = test..*.(re

Re: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Kenneth Kawamoto
Yes that's that :) Anyway in your case you know the incoming XML schema so you shouldn't use wildcard * - I think wildcards have serious performance hits. i.e. theXML.topics.topic. should be used rather than theXML..*. Kenneth Kawamoto http://www.materiaprima.co.uk/ Merrill, Jason wrote:

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Merrill, Jason
our internal GTO Innovative Learning Blog subscribe. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kenneth Kawamoto Sent: Monday, July 21, 2008 12:52 PM To: Flash Coders List Subject: Re: [Flashcoders] E4X filtering strange behaviour Yes that's

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Merrill, Jason
OK, so this is almost there, but not quite. If I do as Kenneth suggested (and this should be able to be reproduced), var testXML:XML = data topics topic title=Coldplays New Album / topic title=The Dark

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Robert Leisle
] On Behalf Of Merrill, Jason Sent: Monday, July 21, 2008 12:27 PM To: Flash Coders List Subject: RE: [Flashcoders] E4X filtering strange behaviour OK, so this is almost there, but not quite. If I do as Kenneth suggested (and this should be able to be reproduced), var testXML:XML = data

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Merrill, Jason
var re:RegExp = new RegExp(searchInput.text, g) Thanks - so it looks like I need the global flag, but how do I also pass the i (ignore case) flag if the RegExp constructor only takes the two arguments? Jason Merrill Bank of America Enterprise Technology Global Risk LLD Instructional

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Merrill, Jason
: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Leisle Sent: Monday, July 21, 2008 3:54 PM To: 'Flash Coders List' Subject: RE: [Flashcoders] E4X filtering strange behaviour Hi Jason, This works for me: var testXML:XML = data topics

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Merrill, Jason
OK, I'm like 95% there, but there is still some kind of bug - here is how to reproduce: var testXML:XML = data topics topic title=Coldplay's New Album, Viva La Vida Or Death And All His Friends / topic title=The Dark Knight / topic title=Arrested Development, The Movie / topic

Re: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Kenneth Kawamoto
Of Merrill, Jason Sent: Monday, July 21, 2008 12:27 PM To: Flash Coders List Subject: RE: [Flashcoders] E4X filtering strange behaviour OK, so this is almost there, but not quite. If I do as Kenneth suggested (and this should be able to be reproduced), var testXML:XML = data

Re: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Wagner Amaral
: Monday, July 21, 2008 3:54 PM To: 'Flash Coders List' Subject: RE: [Flashcoders] E4X filtering strange behaviour Hi Jason, This works for me: var testXML:XML = data topics topic title=Coldplays New Album

Re: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Kenneth Kawamoto
If I may repeat myself I don't think you need g (Global flag) for this. :) The reason is, I quote from the doc, If the g (global) flag is set for the regular expression, then the search starts at the index position specified by the lastIndex property of the regular expression. If the search

Re: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Kenneth Kawamoto
Subject: Re: [Flashcoders] E4X filtering strange behaviour Yes that's that :) Anyway in your case you know the incoming XML schema so you shouldn't use wildcard * - I think wildcards have serious performance hits. i.e. theXML.topics.topic. should be used rather than theXML..*. Kenneth Kawamoto

Re: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Keith
Thanks for showing these results. I'm not missing the attribute method that much...and after this I don't feel any guilt for it. :) -- Keith H -- http://keith-hair.com Kenneth Kawamoto wrote: I just run a quick and dirty test, and I think I can confirm that. The following test for

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Merrill, Jason
? Check out our internal GTO Innovative Learning Blog subscribe. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Keith Sent: Monday, July 21, 2008 8:19 PM To: Flash Coders List Subject: Re: [Flashcoders] E4X filtering strange behaviour Thanks for showing

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Merrill, Jason
So in the following code, why doesn't it find the node containing The Dark Knight? Yet, if I switch out Dark in the RegExp argument for The, it indeed finds all the nodes that have The in it. If I again, switch out the word, Violet, then nothing gets returned. If I put Of, then it returns the

Re: [Flashcoders] E4X filtering strange behaviour

2008-07-21 Thread Keith
Why not use toXMLString(): trace(result: +xmlListSearch.toXMLString()); When I add more than one node with Dark in the title attribute it finds it with toString(). I've always used toXMLString() so I was unaware of this. -- Keith H -- http://keith-hair.com Merrill, Jason wrote: So in

Re: [Flashcoders] E4X filtering strange behaviour

2008-07-19 Thread Kenneth Kawamoto
The code was based on your example and therefore we know the XML schema, i.e. we know the node name and they all have the attribute title. If we don't know anything about the XML we could do something like: var xmlListSearch:XMLList = test..*.(re[test](attribute(*)) || re[test](child(*)));

[Flashcoders] E4X filtering strange behaviour

2008-07-18 Thread Wagner Amaral
I was doing some tests here using code from Jason Merril (see previous thread today), and something has brought my attention. Here's the xml: var test:XML = data topics topic title=Coldplays New Album / topic title=The Dark Knight / topic

Re: [Flashcoders] E4X filtering strange behaviour

2008-07-18 Thread Kenneth Kawamoto
I get the correct node (although I also get Warning 3594). If you are tracing, you must do trace(xmlListSearch.toXMLString()); Also this is shorter: var xmlListSearch:XMLList = test..topic.(re.test(@title)); Kenneth Kawamoto http://www.materiaprima.co.uk/ Wagner Amaral wrote: I was doing

RE: [Flashcoders] E4X filtering strange behaviour

2008-07-18 Thread Merrill, Jason
Thanks. However, I have been told using @title is not good in most situations because it will return an error if a node doesn't have the attribute, wheras attribute(title) will not. Also this is shorter: var xmlListSearch:XMLList = test..topic.(re.test(@title)); But you still need to specify