Just curious ... i am passing an xml node into a function, says its
called data, and has a structure
aaa
bbb
bbb
bbb
aaa
In the debugger i can type data["0"] and I correctly get the value of
the [0] child .
But in actionscript it returns the whole node as data[0] refers
to "aaa" not its
Hi,
I am having problem to retreive data from nodes that contains colon
with the e4x format.
If you consider the following node:
http://someurl/something.png"; />
how would you then access the data contain by the url attribute?
Many Thanks
Seb
Does your XML document have a "xmlns:thumbnail" attribute in it?
Your XML document might not be formed well.
--Keith H--
> Hi,
>
> I am having problem to retreive data from nodes that contains colon
> with the e4x format.
>
> If you consider the following node:
>
>
>http://someurl/so
Ok, that subject is a bit vague but here's an example of what I mean:
fred
bob
peter
Say we have lots of these group elements in an XML document. I want to
select all groups including the names "fred" and "bob", for example. Is it
possible in one e4x expression?
My guess would be: rootXML.gro
try this:
rootXML.group.(name.text().contains("fred") && name.text().contains("bob"))
- Daniel Freiman
On Mon, Sep 22, 2008 at 5:20 AM, Mark Carter <[EMAIL PROTECTED]> wrote:
>
> Ok, that subject is a bit vague but here's an example of what I mean:
>
>
> fred
> bob
> peter
>
>
> Say we have l
Oh cool, that works, thanks very much Daniel.
Am I right in thinking that "name.text()" is returning an XMLList of text
nodes and "contains(fred)" is basically looking for a match of "fred" in
that list?
In real life, instead of having two names, I have an array of names. I
suppose its not possi
You're correct, but you can also do the filtering in a loop to be dynamic:
var result:XMLList = rootXML.group.(name.text().contains("fred"));
for each (filterName) { // psuedo-code
result = result.(name.text().contains(filterName));
}
return result;
- Daniel Freiman
On Mon, Sep 22, 2008 at 10
That doesnt work for me. Arent you trying to match "fred" against the
lowercased name.text() XMLList?
xitij2000 wrote:
>
> i performed a similar operation by doing:
> rootXML.group.(name.text().toLowerCase()=="fred"&&name.text().toLowerCase()=="bob")
>
> the toLowerCase is just because i neede
I think you'd actually be matching "fred" against the first item in the
list, which would means that the entire expression would always return false
because the first item can't be both "bob" and "fred".
On Mon, Sep 22, 2008 at 11:05 AM, Mark Carter <[EMAIL PROTECTED]> wrote:
>
> That doesnt work
Nice. I see what you've done there (instead of "var result:XMLList =
rootXML.group.name;" as the first line which would have been rather
inefficient).
I suppose this general approach doesnt work if I want to do things like
lowercase or substring matching...?
Daniel Freiman wrote:
>
> You're co
I get "value is not a function" - I guess because toLowerCase() cannot work
on an XMLList. You would have to do:
rootXML.group.(name.text()[0].toLowerCase()=="fred"&&name.text()[0].toLowerCase()=="bob")
which, like you say, would always return nothing.
Or you have to specify group elements wit
name.text()[0] will give you a single XML node of Kind string. If you want
to operate on it as a string simply do: name.text()[0].toString()
On Mon, Sep 22, 2008 at 11:35 AM, Mark Carter <[EMAIL PROTECTED]> wrote:
>
> I get "value is not a function" - I guess because toLowerCase() cannot work
>
It seems to work it out for you when it can.
name.text()[0].toLowerCase() works
name.text().toLowerCase() also works if there is exactly one name child of
each group element.
Daniel Freiman wrote:
>
> name.text()[0] will give you a single XML node of Kind string. If you
> want
> to operate on
return (sItem.indexOf(sMatch) != -1);
}//contains
Tracy
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mark Carter
Sent: Monday, September 22, 2008 11:59 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] e4x problem -
Thanks - thats very useful - hadn't thought of that. Assumed it would not be
possible.
Whats the best way to get a handle on the item element from within the
itemContains function?
I would probably go with this approach:
xlFilteredItems =
_xmlData..group.(nameElementsContainAll(name,filters));
Oops - missed out a check on the match:
// assuming filters are lower case and distinct...
private function nameElementsContainAll(nameElements:XMLList,
filters:Array):Boolean {
var matchedFilters:Array = new Array();
for each (var nameElement:XML in nameElements) {
var matchInde
).
"parent()" would pass the parent node etc.
Tracy
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mark Carter
Sent: Monday, September 22, 2008 11:45 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] e4x problem
17 matches
Mail list logo