-
Nodes named <text> in E4X
HI all,
I must admit I'm not enjoying getting my head around E4X. The latest issue is I can't access any nodes in my tree which have the tag name "text":
Code:
<root>
<section>
<text>Hello</text>
</section>
</root>
This doesn't work...
code: root..text
...I'm guessing because ActionScript thinks I am trying to say "root..text()".
This works...
code: root.section['text']
...but it means I need to know the path first which defeats the purpose of E4X!
Does anyone know a way round this, or do I need to change my tag names to something else?
Cheers,
Dave
Last edited by daveystew; 06-15-2009 at 03:49 PM.
-
OK, I got it. Slightly convoluted, but I guess I'm still learning the power of this new syntax:
code: var list:XMLList = xml..*.elements('text');
-
FK'n_dog
Hi and welcome,
As i understand it, E4X is a new extension to JavaScript that adds direct support for XML to JavaScript.
(with limited browser support)
a typical example is -
Code:
var x = new XML();
x=
<note>
<from>Jani</from>
<body>Don't forget me</body>
</note>;
For the example above, the JavaScript statement: document.write(x.from)
will produce the output: Jani
I posted the above before seeing your reply.
Glad you're sorted
-
Thanks for the welcome MD. Yup, I found some rather good links and am slowly getting my head round it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|